From 772dab200204bd0d2fce503e4b6bc5445407115d Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Fri, 7 Aug 2015 23:08:49 +0800 Subject: [PATCH] Fixed minor problems in test cases. --- tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp | 4 ++-- .../UITextAtlasTest/UITextAtlasTest.cpp | 10 +++++++++- .../CocoStudioGUITest/CocoStudioGUITest.lua | 11 ++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index 8fa66d8534..9475ecef15 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -446,7 +446,7 @@ LabelFNTandTTFEmpty::LabelFNTandTTFEmpty() auto label2 = Label::createWithTTF(ttfConfig,"", TextHAlignment::CENTER,s.width); addChild(label2, 0, kTagBitmapAtlas2); label2->setPosition(Vec2(s.width/2, s.height / 2)); - + auto label3 = Label::createWithCharMap("fonts/tuffy_bold_italic-charmap.plist"); addChild(label3, 0, kTagBitmapAtlas3); label3->setPosition(Vec2(s.width/2, 100)); @@ -814,7 +814,7 @@ std::string LabelFNTUNICODELanguages::title() const std::string LabelFNTUNICODELanguages::subtitle() const { - return "You should see 4 differnt labels:\nIn Spanish, Chinese, Russian and Korean"; + return "You should see 4 differnt labels:\nIn Spanish, Chinese, Russian and Japanese"; } LabelFNTBounds::LabelFNTBounds() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp index 40825aba09..6a09be81f8 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp @@ -22,7 +22,15 @@ bool UITextAtlasTest::init() _uiLayer->addChild(alert); // Create the text atlas - TextAtlas* textAtlas = TextAtlas::create("1234567890", "cocosui/labelatlas.png", 17, 22, "0"); + TextAtlas* textAtlas = nullptr; + if (Director::getInstance()->getWinSizeInPixels().height > 320.f) + { + textAtlas = TextAtlas::create("1234567890", "cocosui/labelatlas.png", 34, 44, "0"); + } + else + { + textAtlas = TextAtlas::create("1234567890", "cocosui/labelatlas.png", 17, 22, "0"); + } textAtlas->setPosition(Vec2((widgetSize.width) / 2, widgetSize.height / 2.0f)); _uiLayer->addChild(textAtlas); diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua index 7f476084a6..46be6df7e0 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua @@ -1211,7 +1211,12 @@ function UILabelAtlasTest:initExtend() local labelAtlas = ccui.TextAtlas:create() - labelAtlas:setProperty("1234567890", "cocosui/labelatlas.png", 17, 22, "0") + if cc.Director:getInstance():getWinSizeInPixels().height > 320 then + labelAtlas:setProperty("1234567890", "cocosui/labelatlas.png", 34, 44, "0") + else + labelAtlas:setProperty("1234567890", "cocosui/labelatlas.png", 17, 22, "0") + end + labelAtlas:setPosition(cc.p((widgetSize.width) / 2, widgetSize.height / 2.0)) self._uiLayer:addChild(labelAtlas) @@ -1390,12 +1395,12 @@ function UITextFieldTest:initExtend() if eventType == ccui.TextFiledEventType.attach_with_ime then local textField = sender local screenSize = cc.Director:getInstance():getWinSize() - textField:runAction(cc.MoveTo:create(0.225,cc.p(screenSize.width / 2.0, screenSize.height / 2.0 + textField:getContentSize().height / 2.0))) + textField:runAction(cc.MoveBy:create(0.225,cc.p(0, textField:getContentSize().height / 2.0))) self._displayValueLabel:setString("attach with IME") elseif eventType == ccui.TextFiledEventType.detach_with_ime then local textField = sender local screenSize = cc.Director:getInstance():getWinSize() - textField:runAction(cc.MoveTo:create(0.175, cc.p(screenSize.width / 2.0, screenSize.height / 2.0))) + textField:runAction(cc.MoveBy:create(0.175, cc.p(0, textField:getContentSize().height / -2.0))) self._displayValueLabel:setString("detach with IME") elseif eventType == ccui.TextFiledEventType.insert_text then self._displayValueLabel:setString("insert words")