From 0be9763a9cef614d0072933b85ec78f0247e92ba Mon Sep 17 00:00:00 2001 From: Jacky Date: Mon, 29 Jun 2015 17:25:13 +0800 Subject: [PATCH] add auto culling test case. --- .../NewRendererTest/NewRendererTest.cpp | 31 +++++++++++++++++++ .../Classes/NewRendererTest/NewRendererTest.h | 11 +++++++ 2 files changed, 42 insertions(+) diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp index dec6214867..2adadc3bbc 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp @@ -35,6 +35,7 @@ NewRendererTests::NewRendererTests() ADD_TEST_CASE(NewCullingTest); ADD_TEST_CASE(VBOFullTest); ADD_TEST_CASE(CaptureScreenTest); + ADD_TEST_CASE(BugAutoCulling) }; std::string MultiSceneTest::title() const @@ -475,3 +476,33 @@ void CaptureScreenTest::afterCaptured(bool succeed, const std::string& outputFil log("Capture screen failed."); } } + +BugAutoCulling::BugAutoCulling() +{ + Size s = Director::getInstance()->getWinSize(); + for (int i=0; i<100; i++) { + auto sprite = Sprite::create("Images/grossini.png"); + sprite->setPosition(s.width/2 + s.width/10 * i, s.height/2); + this->addChild(sprite); + } + this->scheduleOnce([=](float){ + auto camera = Director::getInstance()->getRunningScene()->getCameras().front(); + auto move = MoveBy::create(2.0, Vec2(2 * s.width, 0)); + camera->runAction(Sequence::create(move, move->reverse(),nullptr)); + }, 1.0f, "lambda-autoculling-bug"); +} + +BugAutoCulling::~BugAutoCulling() +{ + +} + +std::string BugAutoCulling::title() const +{ + return "Bug-AutoCulling"; +} + +std::string BugAutoCulling::subtitle() const +{ + return "Moving the camera to the right instead of moving the layer"; +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h index 6c44044a14..aa1c1bc25a 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h @@ -129,4 +129,15 @@ protected: std::string _filename; }; +class BugAutoCulling : public MultiSceneTest +{ +public: + CREATE_FUNC(BugAutoCulling); + virtual std::string title() const override; + virtual std::string subtitle() const override; +protected: + BugAutoCulling(); + virtual ~BugAutoCulling(); +}; + #endif //__NewRendererTest_H_