* fix conflict effect

* set index to 1 before running a test case
This commit is contained in:
minggo 2016-12-14 09:28:19 +08:00 committed by GitHub
parent 5823f5792b
commit de670c1913
35 changed files with 64 additions and 2 deletions

View File

@ -33,6 +33,20 @@ bool UIScene::init()
Size rootSize = _widget->getContentSize(); Size rootSize = _widget->getContentSize();
_uiLayer->setPosition(Vec2((screenSize.width - rootSize.width) / 2, _uiLayer->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
(screenSize.height - rootSize.height) / 2)); (screenSize.height - rootSize.height) / 2));
// disable these widgets because they are confict with menu itmes created in `TestCase`
auto restartButton = Helper::seekWidgetByName(_widget, "middle_Button");
restartButton->setVisible(false);
restartButton->setEnabled(false);
auto leftButton = Helper::seekWidgetByName(_widget, "left_Button");
leftButton->setVisible(false);
leftButton->setEnabled(false);
auto rightButton = Helper::seekWidgetByName(_widget, "right_Button");
rightButton->setVisible(false);
rightButton->setEnabled(false);
Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81)); Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));

View File

@ -190,6 +190,8 @@ function ActionManagerTestMain()
RemoveTest, RemoveTest,
ResumeTest ResumeTest
} }
Helper.index = 1
scene:addChild(CrashTest()) scene:addChild(CrashTest())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -460,6 +460,7 @@ function EaseActionsTest()
SpriteEaseBackInOut, SpriteEaseBackInOut,
SpeedTest SpeedTest
} }
Helper.index = 1
scene:addChild(SpriteEase()) scene:addChild(SpriteEase())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -290,6 +290,7 @@ function ProgressActionsTest()
SpriteProgressBarTintAndFade, SpriteProgressBarTintAndFade,
SpriteProgressWithSpriteFrame SpriteProgressWithSpriteFrame
} }
Helper.index = 1
scene:addChild(SpriteProgressToRadial()) scene:addChild(SpriteProgressToRadial())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -1261,6 +1261,7 @@ function ActionsTest()
ActionIssue1288_2, ActionIssue1288_2,
ActionIssue1327 ActionIssue1327
} }
Helper.index = 1
scene:addChild(ActionManual()) scene:addChild(ActionManual())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -328,6 +328,7 @@ function AssetsManagerExTestMain()
AMTestScene2.create, AMTestScene2.create,
AMTestScene3.create, AMTestScene3.create,
} }
Helper.index = 1
scene:addChild(AMTestScene1.create()) scene:addChild(AMTestScene1.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -257,6 +257,8 @@ function EffectAdvancedTestMain()
Effect5, Effect5,
Issue631 Issue631
} }
Helper.index = 1
scene:addChild(Effect3()) scene:addChild(Effect3())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -1147,6 +1147,8 @@ function FastTiledMapTestMain()
TMXBug787, TMXBug787,
-- TMXGIDObjectsTestNew, -- TMXGIDObjectsTestNew,
} }
Helper.index = 1
scene:addChild(TMXIsoZorder()) scene:addChild(TMXIsoZorder())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -102,6 +102,8 @@ function FontTestMain()
createTestLayer, createTestLayer,
createTestLayer createTestLayer
} }
Helper.index = 1
scene:addChild(createTestLayer()) scene:addChild(createTestLayer())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -1406,6 +1406,8 @@ function LabelTest()
LabelTTFAlignment.create, LabelTTFAlignment.create,
LabelBMFontBounds.create LabelBMFontBounds.create
} }
Helper.index = 1
scene:addChild(LabelAtlasTest.create()) scene:addChild(LabelAtlasTest.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -1734,6 +1734,8 @@ function LabelTestNew()
LabelAlignmentTest.create, LabelAlignmentTest.create,
LabelIssue4428Test.create, LabelIssue4428Test.create,
} }
Helper.index = 1
scene:addChild(LabelFNTColorAndOpacity.create()) scene:addChild(LabelFNTColorAndOpacity.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -652,6 +652,8 @@ function LayerTestMain()
LayerIgnoreAnchorPointScale, LayerIgnoreAnchorPointScale,
LayerExtendedBlendOpacityTest LayerExtendedBlendOpacityTest
} }
Helper.index = 1
scene:addChild(LayerTestCascadingOpacityA()) scene:addChild(LayerTestCascadingOpacityA())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -234,6 +234,7 @@ function LightTestMain()
{ {
LightTest.create, LightTest.create,
} }
Helper.index = 1
scene:addChild(LightTest.create(), 0) scene:addChild(LightTest.create(), 0)
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -339,6 +339,7 @@ function MaterialSystemTest()
Material_Sprite3DTest.create, Material_Sprite3DTest.create,
Material_parsePerformance.create, Material_parsePerformance.create,
} }
Helper.index = 1
scene:addChild(Material_2DEffects.create()) scene:addChild(Material_2DEffects.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -173,6 +173,7 @@ function MotionStreakTest()
MotionStreakTest2, MotionStreakTest2,
Issue1358 Issue1358
} }
Helper.index = 1
scene:addChild(MotionStreakTest1()) scene:addChild(MotionStreakTest1())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -519,6 +519,8 @@ function AudioEngineTest()
InvalidAudioFileTest.create, InvalidAudioFileTest.create,
LargeAudioFileTest.create LargeAudioFileTest.create
} }
Helper.index = 1
scene:addChild(AudioControlTest.create()) scene:addChild(AudioControlTest.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -701,6 +701,7 @@ function CocosNodeTest()
NodeNonOpaqueTest, NodeNonOpaqueTest,
NodeGlobalZValueTest, NodeGlobalZValueTest,
} }
Helper.index = 1
scene:addChild(CameraCenterTest()) scene:addChild(CameraCenterTest())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -151,6 +151,8 @@ function ParallaxTestMain()
Parallax1, Parallax1,
Parallax2 Parallax2
} }
Helper.index = 1
scene:addChild(Parallax1()) scene:addChild(Parallax1())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -657,6 +657,7 @@ function Particle3DTest()
Particle3DWeaponTrailDemo.create, Particle3DWeaponTrailDemo.create,
Particle3DWithSprite3DDemo.create, Particle3DWithSprite3DDemo.create,
} }
Helper.index = 1
scene:addChild(Particle3DExplosionSystemDemo.create()) scene:addChild(Particle3DExplosionSystemDemo.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -705,6 +705,7 @@ function Physics3DTest()
Physics3DCollisionCallbackDemo.create, Physics3DCollisionCallbackDemo.create,
Physics3DTerrainDemo.create, Physics3DTerrainDemo.create,
} }
Helper.index = 1
scene:addChild(BasicPhysics3DDemo.create()) scene:addChild(BasicPhysics3DDemo.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -1738,6 +1738,7 @@ function PhysicsTest()
PhysicsTransformTest, PhysicsTransformTest,
PhysicsIssue9959 PhysicsIssue9959
} }
Helper.index = 1
scene:addChild(Helper.createFunctionTable[1]()) scene:addChild(Helper.createFunctionTable[1]())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -609,6 +609,8 @@ function RenderTextureTestMain()
-- RenderTextureTargetNode, -- RenderTextureTargetNode,
-- SpriteRenderTextureBug -- SpriteRenderTextureBug
} }
Helper.index = 1
scene:addChild(RenderTextureSave()) scene:addChild(RenderTextureSave())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -670,6 +670,7 @@ function Scene3DTestMain()
{ {
Scene3DTest.create, Scene3DTest.create,
} }
Helper.index = 1
scene:addChild(Scene3DTest.create()) scene:addChild(Scene3DTest.create())
local menu = CreateBackMenuItem() local menu = CreateBackMenuItem()

View File

@ -141,6 +141,7 @@ function SpineTestMain()
SpineTestLayerNormal.create, SpineTestLayerNormal.create,
SpineTestLayerFFD.create, SpineTestLayerFFD.create,
} }
Helper.index = 1
scene:addChild(SpineTestLayerNormal.create(), 0) scene:addChild(SpineTestLayerNormal.create(), 0)
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -1369,6 +1369,7 @@ function Sprite3DTest()
Sprite3DNormalMappingTest.create, Sprite3DNormalMappingTest.create,
Sprite3DMaterialTest.create, Sprite3DMaterialTest.create,
} }
Helper.index = 1
scene:addChild(Sprite3DBasicTest.create()) scene:addChild(Sprite3DBasicTest.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -567,6 +567,7 @@ function SpritePolygonTest()
SpritePolygonPerformanceTestDynamic.create, SpritePolygonPerformanceTestDynamic.create,
SpritePerformanceTestDynamic.create, SpritePerformanceTestDynamic.create,
} }
Helper.index = 1
scene:addChild(SpritePolygonTest1.create()) scene:addChild(SpritePolygonTest1.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -1580,6 +1580,7 @@ function SpriteTest()
SpriteBatchNodeOffsetAnchorRotationalSkewScale.create, SpriteBatchNodeOffsetAnchorRotationalSkewScale.create,
SpriteOffsetAnchorFlip.create SpriteOffsetAnchorFlip.create
} }
Helper.index = 1
scene:addChild(Sprite1.create()) scene:addChild(Sprite1.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -332,6 +332,7 @@ function TerrainTest()
TerrainSimple.create, TerrainSimple.create,
TerrainWalkThru.create, TerrainWalkThru.create,
} }
Helper.index = 1
scene:addChild(TerrainSimple.create()) scene:addChild(TerrainSimple.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())

View File

@ -31,6 +31,8 @@ function TextInputTestMain()
Helper.createFunctionTable = { Helper.createFunctionTable = {
TextInput.create, TextInput.create,
} }
Helper.index = 1
scene:addChild(TextInput.create()) scene:addChild(TextInput.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -1449,6 +1449,8 @@ function Texture2dTestMain()
TextureDrawAtPoint, TextureDrawAtPoint,
TextureDrawInRect TextureDrawInRect
} }
Helper.index = 1
scene:addChild(TextureMemoryAlloc()) scene:addChild(TextureMemoryAlloc())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -1236,6 +1236,8 @@ function TileMapTestMain()
TMXBug987, TMXBug987,
TMXBug787 TMXBug787
} }
Helper.index = 1
scene:addChild(TileMapTest()) scene:addChild(TileMapTest())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -57,6 +57,8 @@ function VibrateTestMain()
Helper.createFunctionTable = { Helper.createFunctionTable = {
VibrateControlTest.create VibrateControlTest.create
} }
Helper.index = 1
scene:addChild(VibrateControlTest.create()) scene:addChild(VibrateControlTest.create())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -135,11 +135,12 @@ end
function VideoPlayerTestMain() function VideoPlayerTestMain()
Helper.index = 1
local scene = cc.Scene:create() local scene = cc.Scene:create()
Helper.createFunctionTable = { Helper.createFunctionTable = {
VideoPlayerTest VideoPlayerTest
} }
Helper.index = 1
scene:addChild(VideoPlayerTest()) scene:addChild(VideoPlayerTest())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene

View File

@ -121,6 +121,7 @@ function WebViewTestMain()
{ {
WebViewTest.create, WebViewTest.create,
} }
Helper.index = 1
local scene = cc.Scene:create() local scene = cc.Scene:create()
scene:addChild(WebViewTest.create()) scene:addChild(WebViewTest.create())

View File

@ -117,11 +117,12 @@ end
function ZwoptexTestMain() function ZwoptexTestMain()
cclog("ZwoptexTestMain") cclog("ZwoptexTestMain")
Helper.index = 1
local scene = cc.Scene:create() local scene = cc.Scene:create()
Helper.createFunctionTable = { Helper.createFunctionTable = {
ZwoptexGenericTest ZwoptexGenericTest
} }
Helper.index = 1
scene:addChild(ZwoptexGenericTest()) scene:addChild(ZwoptexGenericTest())
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
return scene return scene