Fixed minor problems in test cases.

This commit is contained in:
WenhaiLin 2015-08-07 23:08:49 +08:00
parent d182c37f29
commit 772dab2002
3 changed files with 19 additions and 6 deletions
tests
cpp-tests/Classes
LabelTest
UITest/CocoStudioGUITest/UITextAtlasTest
lua-tests/src/CocoStudioTest/CocoStudioGUITest

View File

@ -814,7 +814,7 @@ std::string LabelFNTUNICODELanguages::title() const
std::string LabelFNTUNICODELanguages::subtitle() 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() LabelFNTBounds::LabelFNTBounds()

View File

@ -22,7 +22,15 @@ bool UITextAtlasTest::init()
_uiLayer->addChild(alert); _uiLayer->addChild(alert);
// Create the text atlas // 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)); textAtlas->setPosition(Vec2((widgetSize.width) / 2, widgetSize.height / 2.0f));
_uiLayer->addChild(textAtlas); _uiLayer->addChild(textAtlas);

View File

@ -1211,7 +1211,12 @@ function UILabelAtlasTest:initExtend()
local labelAtlas = ccui.TextAtlas:create() 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)) labelAtlas:setPosition(cc.p((widgetSize.width) / 2, widgetSize.height / 2.0))
self._uiLayer:addChild(labelAtlas) self._uiLayer:addChild(labelAtlas)
@ -1390,12 +1395,12 @@ function UITextFieldTest:initExtend()
if eventType == ccui.TextFiledEventType.attach_with_ime then if eventType == ccui.TextFiledEventType.attach_with_ime then
local textField = sender local textField = sender
local screenSize = cc.Director:getInstance():getWinSize() 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") self._displayValueLabel:setString("attach with IME")
elseif eventType == ccui.TextFiledEventType.detach_with_ime then elseif eventType == ccui.TextFiledEventType.detach_with_ime then
local textField = sender local textField = sender
local screenSize = cc.Director:getInstance():getWinSize() 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") self._displayValueLabel:setString("detach with IME")
elseif eventType == ccui.TextFiledEventType.insert_text then elseif eventType == ccui.TextFiledEventType.insert_text then
self._displayValueLabel:setString("insert words") self._displayValueLabel:setString("insert words")