From 47e269898699516d82370341a6228ad3fe026b7f Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Wed, 22 Apr 2015 10:20:21 +0800 Subject: [PATCH] Fix the cocos3.6beta0 bugs --- tests/cpp-tests/Classes/AppDelegate.cpp | 4 +++ .../CocoStudioArmatureTest/ArmatureScene.cpp | 13 +++++++-- .../ComponentsTestScene.cpp | 2 +- .../GameOverScene.cpp | 2 +- tests/cpp-tests/Classes/FontTest/FontTest.cpp | 27 +++++++++++++------ .../cpp-tests/Classes/LayerTest/LayerTest.cpp | 5 ++++ tests/cpp-tests/Classes/LayerTest/LayerTest.h | 2 ++ .../Classes/TextInputTest/TextInputTest.cpp | 8 ------ .../UIScrollViewTest_Editor.cpp | 4 +-- tests/lua-tests/src/BugsTest/BugsTest.lua | 12 +++++++-- .../CocosDenshionTest/CocosDenshionTest.lua | 2 +- 11 files changed, 56 insertions(+), 25 deletions(-) diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index 8d59326042..ef0c4938ea 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -171,6 +171,10 @@ bool AppDelegate::applicationDidFinishLaunching() #else glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); #endif + + // Enable Remote Console + auto console = director->getConsole(); + console->listenOnTCP(5678); _testController = TestController::getInstance(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 9342bfb93c..a7950f977c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -574,7 +574,7 @@ void TestColliderDetector::onEnter() armature2->setScaleX(-0.2f); armature2->setScaleY(0.2f); armature2->setPosition(VisibleRect::right().x - 60, VisibleRect::left().y); - addChild(armature2); + addChild(armature2,1); #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT bullet = cocos2d::extension::PhysicsSprite::createWithSpriteFrameName("25.png"); @@ -582,7 +582,7 @@ void TestColliderDetector::onEnter() bullet = Sprite::createWithSpriteFrameName("25.png"); drawNode = DrawNode::create(); - addChild(drawNode, -1); + addChild(drawNode); #endif addChild(bullet); @@ -1227,6 +1227,10 @@ std::string TestPlaySeveralMovement::subtitle()const void TestEasing::onEnter() { ArmatureBaseTest::onEnter(); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesEnded = CC_CALLBACK_2(TestEasing::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); animationID = 0; armature = Armature::create("testEasing"); @@ -1237,6 +1241,7 @@ void TestEasing::onEnter() addChild(armature); updateSubTitle(); + } std::string TestEasing::title() const @@ -1264,6 +1269,10 @@ void TestEasing::updateSubTitle() void TestChangeAnimationInternal::onEnter() { ArmatureBaseTest::onEnter(); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesEnded = CC_CALLBACK_2(TestChangeAnimationInternal::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); Armature *armature = nullptr; armature = Armature::create("Cowboy"); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp index f900a68294..b27efe2a35 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp @@ -17,7 +17,7 @@ bool CocoStudioComponentsTest::init() { if (TestCase::init()) { - auto bg = LayerColor::create(Color4B(255, 255, 255, 255)); + auto bg = LayerColor::create(Color4B(0, 128, 255, 255)); addChild(bg); auto root = createGameScene(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp index cb7b3d84ba..963ac05643 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp @@ -57,7 +57,7 @@ GameOverScene::~GameOverScene() bool GameOverLayer::init() { - if ( LayerColor::initWithColor( Color4B(255,255,255,255) ) ) + if ( LayerColor::initWithColor( Color4B(0,128,255,255) ) ) { auto winSize = Director::getInstance()->getWinSize(); this->_label = Label::createWithTTF("","fonts/arial.ttf", 32); diff --git a/tests/cpp-tests/Classes/FontTest/FontTest.cpp b/tests/cpp-tests/Classes/FontTest/FontTest.cpp index 6716413b12..a31b923cc4 100644 --- a/tests/cpp-tests/Classes/FontTest/FontTest.cpp +++ b/tests/cpp-tests/Classes/FontTest/FontTest.cpp @@ -25,14 +25,6 @@ static std::string fontList[] = "fonts/Scissor Cuts.ttf", }; -FontTests::FontTests() -{ - for (auto& fontFile : fontList) - { - addTestCase("FontTests", [&](){return FontTest::create(fontFile); }); - } -} - static int vAlignIdx = 0; static TextVAlignment verticalAlignment[] = { @@ -41,6 +33,25 @@ static TextVAlignment verticalAlignment[] = TextVAlignment::BOTTOM, }; + +FontTests::FontTests() +{ + for (auto& fontFile : fontList) + { + addTestCase("FontTests", [&](){vAlignIdx = 0; return FontTest::create(fontFile); }); + } + + for (auto& fontFile : fontList) + { + addTestCase("FontTests", [&](){ vAlignIdx = 1; return FontTest::create(fontFile); }); + } + + for (auto& fontFile : fontList) + { + addTestCase("FontTests", [&](){vAlignIdx = 2; return FontTest::create(fontFile); }); + } +} + void FontTest::showFont(const std::string& fontFile) { auto s = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index 367c0fd8ab..1c1c2f9bc3 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -44,6 +44,11 @@ static void setEnableRecursiveCascading(Node* node, bool enable) } } +std::string LayerTest::title() const +{ + return "Layer Test"; +} + // LayerTestCascadingOpacityA void LayerTestCascadingOpacityA::onEnter() { diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.h b/tests/cpp-tests/Classes/LayerTest/LayerTest.h index 9549c030ca..c529b74c01 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.h +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.h @@ -7,6 +7,8 @@ DEFINE_TEST_SUITE(LayerTests); class LayerTest : public TestCase { +public: + virtual std::string title() const override; protected: std::string _title; }; diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index 3903f88355..2350012bd2 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -211,14 +211,6 @@ void TextFieldTTFActionTest::onEnter() // add TextFieldTTF auto s = Director::getInstance()->getWinSize(); - std::string strSubtitle = subtitle(); - TTFConfig ttfConfig; - ttfConfig.fontFilePath = FONT_NAME; - ttfConfig.fontSize = 16; - auto subTitle = Label::createWithTTF(ttfConfig, strSubtitle.c_str()); - addChild(subTitle, 9999); - subTitle->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60); - _textField = TextFieldTTF::textFieldWithPlaceHolder("", FONT_NAME, FONT_SIZE); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp index dbc6bf49c9..d4dfcd6dba 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest_Editor.cpp @@ -9,8 +9,8 @@ UIScrollViewEditorTests::UIScrollViewEditorTests() ADD_TEST_CASE(UIScrollViewTest_Vertical_Editor); ADD_TEST_CASE(UIScrollViewTest_Horizontal_Editor); ADD_TEST_CASE(UIScrollViewTest_Both_Editor); - ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor); - ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor); +// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor); +// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor); } // UIScrollViewTest_Vertical_Editor diff --git a/tests/lua-tests/src/BugsTest/BugsTest.lua b/tests/lua-tests/src/BugsTest/BugsTest.lua index e20eeddbe6..ee3a6e44fd 100644 --- a/tests/lua-tests/src/BugsTest/BugsTest.lua +++ b/tests/lua-tests/src/BugsTest/BugsTest.lua @@ -406,7 +406,15 @@ end --BugTest1174 local function BugTest1174() - local pLayer = cc.Layer:create() + local layer = cc.Layer:create() + + local size = cc.Director:getInstance():getWinSize() + + + local subtitleLabel = cc.Label:createWithTTF("The results output on the console", s_thonburiPath, 24) + subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5)) + layer:addChild(subtitleLabel, 1) + subtitleLabel:setPosition(size.width / 2, size.height - 80) local function check_for_error(p1,p2,p3,p4,s,t) local p4_p3 = cc.pSub(p4,p3) @@ -549,7 +557,7 @@ local function BugTest1174() strLog = "Test3 - End. OK="..ok..", Err="..err print(strLog) - return pLayer + return layer end --BugTestValueTypeJudgeInTable diff --git a/tests/lua-tests/src/CocosDenshionTest/CocosDenshionTest.lua b/tests/lua-tests/src/CocosDenshionTest/CocosDenshionTest.lua index 6c6112a2b1..0d058f8be7 100644 --- a/tests/lua-tests/src/CocosDenshionTest/CocosDenshionTest.lua +++ b/tests/lua-tests/src/CocosDenshionTest/CocosDenshionTest.lua @@ -22,7 +22,7 @@ local function CocosDenshionTest() "pause background music", "resume background music", "rewind background music", - "is background music playing", + "is background music playing(output on the console)", "play effect", "play effect repeatly", "stop effect",