From 4be149e492bddd468b1dadb4827eb668a254f50f Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 11 Apr 2014 16:30:25 +0800 Subject: [PATCH] closed #4761, fix zfighting between tests --- tests/cpp-tests/Classes/NodeTest/NodeTest.cpp | 2 ++ tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp | 6 ++++++ tests/cpp-tests/Classes/TileMapTest/TileMapTest.h | 1 + tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp | 2 ++ 4 files changed, 11 insertions(+) diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 251eeaac60..b4ac8cb444 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -1053,6 +1053,7 @@ void CameraTest1::onEnter() void CameraTest1::onExit() { Director::getInstance()->setProjection(_preProjection); + Director::getInstance()->setDepthTest(false); TestCocosNodeDemo::onExit(); } @@ -1100,6 +1101,7 @@ void CameraTest2::onEnter() void CameraTest2::onExit() { Director::getInstance()->setProjection(_preProjection); + Director::getInstance()->setDepthTest(false); TestCocosNodeDemo::onExit(); } diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp index a44e3f0e08..995d59e1a4 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp @@ -118,6 +118,11 @@ void TileDemo::onEnter() BaseTest::onEnter(); } +void TileMapTestScene::onExit() +{ + Layer::onExit(); + Director::getInstance()->setDepthTest(false); +} void TileDemo::restartCallback(Ref* sender) { auto s = new TileMapTestScene(); @@ -166,6 +171,7 @@ void TileMapTestScene::runThisTest() Director::getInstance()->replaceScene(this); } + //------------------------------------------------------------------ // // TileMapTest diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h index 57e5db5895..ef8e60fdcc 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h @@ -14,6 +14,7 @@ public: virtual std::string title() const override; virtual std::string subtitle() const override; virtual void onEnter() override; + virtual void onExit()override; void restartCallback(Ref* sender); void nextCallback(Ref* sender); diff --git a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp index 53d1faf8fc..b190c7ce5e 100644 --- a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp +++ b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp @@ -380,6 +380,7 @@ void TestLayer1::onExitTransitionDidStart() void TestLayer1::onExit() { Layer::onExit(); + Director::getInstance()->setDepthTest(false); log("Scene 1 onExit"); } @@ -509,5 +510,6 @@ void TestLayer2::onExitTransitionDidStart() void TestLayer2::onExit() { Layer::onExit(); + Director::getInstance()->setDepthTest(false); log("Scene 2 onExit"); }