diff --git a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua index e977c54df8..4154419fdc 100644 --- a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua +++ b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua @@ -1032,7 +1032,6 @@ end ---------------------------------------- local Sprite3DCubeMapTest = class("Sprite3DCubeMapTest", function () local layer = cc.Layer:create() - Helper.initWithLayer(layer) return layer end) @@ -1045,9 +1044,6 @@ function Sprite3DCubeMapTest:ctor() end function Sprite3DCubeMapTest:init() - Helper.titleLabel:setString(self:title()) - Helper.subtitleLabel:setString(self:subtitle()) - self:registerScriptHandler(function (event) if event == "enter" then self:onEnter() @@ -1068,6 +1064,9 @@ end function Sprite3DCubeMapTest:onEnter() local s = cc.Director:getInstance():getWinSize() self:addNewSpriteWithCoords(cc.p(s.width / 2, s.height / 2)) + Helper.initWithLayer(self) + Helper.titleLabel:setString(self:title()) + Helper.subtitleLabel:setString(self:subtitle()) end function Sprite3DCubeMapTest:onExit() diff --git a/tests/lua-tests/src/TerrainTest/TerrainTest.lua b/tests/lua-tests/src/TerrainTest/TerrainTest.lua index a723e06ab5..85b2b048b3 100644 --- a/tests/lua-tests/src/TerrainTest/TerrainTest.lua +++ b/tests/lua-tests/src/TerrainTest/TerrainTest.lua @@ -5,7 +5,7 @@ require "cocos.3d.3dConstants" ---------------------------------------- local TerrainSimple = class("TerrainSimple", function () local layer = cc.Layer:create() - Helper.initWithLayer(layer) + return layer end) @@ -15,8 +15,7 @@ function TerrainSimple:ctor() end function TerrainSimple:init() - Helper.titleLabel:setString(self:title()) - Helper.subtitleLabel:setString(self:subtitle()) + local visibleSize = cc.Director:getInstance():getVisibleSize() @@ -26,6 +25,10 @@ function TerrainSimple:init() self._camera:setPosition3D(cc.vec3(-1, 1.6, 4)) self:addChild(self._camera) + Helper.initWithLayer(self) + Helper.titleLabel:setString(self:title()) + Helper.subtitleLabel:setString(self:subtitle()) + local detailMapR = { _detailMapSrc = "TerrainTest/dirt.jpg", _detailMapSize = 35} local detailMapG = { _detailMapSrc = "TerrainTest/Grass2.jpg", _detailMapSize = 35} local detailMapB = { _detailMapSrc = "TerrainTest/road.jpg", _detailMapSize = 35}