mirror of https://github.com/axmolengine/axmol.git
Fix minor typos in UI test cases (#17400)
This commit is contained in:
parent
c86d7b0d2f
commit
3937b4d631
|
@ -439,7 +439,7 @@ bool UIButtonTest_Title::init()
|
||||||
button->setTitleText("Title Button!");
|
button->setTitleText("Title Button!");
|
||||||
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
button->setTitleColor(Color3B::YELLOW);
|
button->setTitleColor(Color3B::YELLOW);
|
||||||
CCASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColotr & getTitleColor not match!");
|
CCASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColor & getTitleColor not match!");
|
||||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Title::touchEvent, this));
|
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Title::touchEvent, this));
|
||||||
_uiLayer->addChild(button);
|
_uiLayer->addChild(button);
|
||||||
button->setFlippedX(true);
|
button->setFlippedX(true);
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool UICheckBoxDefaultBehaviorTest::init()
|
||||||
_uiLayer->addChild(_displayValueLabel);
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
|
||||||
// Add the alert
|
// Add the alert
|
||||||
Text* alert = Text::create("Only left two and the last checkbox can be cliked!","fonts/Marker Felt.ttf",20 );
|
Text* alert = Text::create("Only left two and the last checkbox can be clicked!","fonts/Marker Felt.ttf",20 );
|
||||||
alert->setColor(Color3B(159, 168, 176));
|
alert->setColor(Color3B(159, 168, 176));
|
||||||
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||||
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
|
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
|
||||||
|
|
|
@ -21,7 +21,7 @@ UIListViewTests::UIListViewTests()
|
||||||
|
|
||||||
UIListViewTest_Vertical::UIListViewTest_Vertical()
|
UIListViewTest_Vertical::UIListViewTest_Vertical()
|
||||||
: _displayValueLabel(nullptr),
|
: _displayValueLabel(nullptr),
|
||||||
_spawnCount(5), //swpanCount should > listview.width / tempalteWidth + 2
|
_spawnCount(5), //spawnCount should > listview.width / templateWidth + 2
|
||||||
_totalCount(50),
|
_totalCount(50),
|
||||||
_bufferZone(45), //bufferZone should be larger than List item width
|
_bufferZone(45), //bufferZone should be larger than List item width
|
||||||
_updateTimer(0),
|
_updateTimer(0),
|
||||||
|
@ -217,7 +217,7 @@ void UIListViewTest_Vertical::update(float dt)
|
||||||
if (itemPos < -_bufferZone && item->getPosition().y + _reuseItemOffset < totalHeight) {
|
if (itemPos < -_bufferZone && item->getPosition().y + _reuseItemOffset < totalHeight) {
|
||||||
int itemID = item->getTag() - (int)items.size();
|
int itemID = item->getTag() - (int)items.size();
|
||||||
item->setPositionY(item->getPositionY() + _reuseItemOffset);
|
item->setPositionY(item->getPositionY() + _reuseItemOffset);
|
||||||
CCLOG("itemPos = %f, itemID = %d, tempateID = %d", itemPos, itemID, i);
|
CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i);
|
||||||
this->updateItem(itemID, i);
|
this->updateItem(itemID, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ void UIListViewTest_Vertical::selectedItemEventScrollView(Ref* pSender, ui::Scro
|
||||||
|
|
||||||
UIListViewTest_Horizontal::UIListViewTest_Horizontal()
|
UIListViewTest_Horizontal::UIListViewTest_Horizontal()
|
||||||
: _displayValueLabel(nullptr),
|
: _displayValueLabel(nullptr),
|
||||||
_spawnCount(4), //swpanCount should > listview.width / tempalteWidth + 2
|
_spawnCount(4), //spawnCount should > listview.width / templateWidth + 2
|
||||||
_totalCount(50),
|
_totalCount(50),
|
||||||
_bufferZone(140), //bufferZone should be larger than List item width
|
_bufferZone(140), //bufferZone should be larger than List item width
|
||||||
_updateTimer(0),
|
_updateTimer(0),
|
||||||
|
@ -432,7 +432,7 @@ void UIListViewTest_Horizontal::update(float dt)
|
||||||
if (itemPos < -_bufferZone && item->getPosition().x + _reuseItemOffset < totalWidth) {
|
if (itemPos < -_bufferZone && item->getPosition().x + _reuseItemOffset < totalWidth) {
|
||||||
int itemID = item->getTag() + (int)items.size();
|
int itemID = item->getTag() + (int)items.size();
|
||||||
item->setPositionX(item->getPositionX() + _reuseItemOffset);
|
item->setPositionX(item->getPositionX() + _reuseItemOffset);
|
||||||
CCLOG("itemPos = %f, itemID = %d, tempateID = %d", itemPos, itemID, i);
|
CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i);
|
||||||
this->updateItem(itemID, i);
|
this->updateItem(itemID, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ bool UIPageViewTouchPropagationTest::init()
|
||||||
|
|
||||||
auto eventListener = EventListenerTouchOneByOne::create();
|
auto eventListener = EventListenerTouchOneByOne::create();
|
||||||
eventListener->onTouchBegan = [](Touch* touch, Event* event) -> bool{
|
eventListener->onTouchBegan = [](Touch* touch, Event* event) -> bool{
|
||||||
CCLOG("layout recieves touches");
|
CCLOG("layout receives touches");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(eventListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(eventListener, this);
|
||||||
|
@ -985,7 +985,7 @@ bool UIPageViewIndicatorTest::init()
|
||||||
Size widgetSize = _widget->getContentSize();
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
// Add a label in which the dragpanel events will be displayed
|
// Add a label in which the dragpanel events will be displayed
|
||||||
_displayValueLabel = Text::create("PageView indidcator custom texture\nscale : 0.5, index color: RED", "fonts/Marker Felt.ttf", 16);
|
_displayValueLabel = Text::create("PageView indicator custom texture\nscale : 0.5, index color: RED", "fonts/Marker Felt.ttf", 16);
|
||||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||||
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
|
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||||
widgetSize.height / 2.0f +
|
widgetSize.height / 2.0f +
|
||||||
|
|
|
@ -355,7 +355,7 @@ bool UIRichTextXMLColor::init()
|
||||||
|
|
||||||
|
|
||||||
// RichText
|
// RichText
|
||||||
_richText = RichText::createWithXML("Defaul color.<font color='#ff0000'>red.<font color='#00ff00'>green</font>red again.</font>default again");
|
_richText = RichText::createWithXML("Default color.<font color='#ff0000'>red.<font color='#00ff00'>green</font>red again.</font>default again");
|
||||||
_richText->ignoreContentAdaptWithSize(false);
|
_richText->ignoreContentAdaptWithSize(false);
|
||||||
_richText->setContentSize(Size(100, 100));
|
_richText->setContentSize(Size(100, 100));
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ bool UIScene::init()
|
||||||
_uiLayer->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
_uiLayer->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
|
||||||
(screenSize.height - rootSize.height) / 2));
|
(screenSize.height - rootSize.height) / 2));
|
||||||
|
|
||||||
// disable these widgets because they are confict with menu itmes created in `TestCase`
|
// disable these widgets because they are conflict with menu items created in `TestCase`
|
||||||
|
|
||||||
auto restartButton = Helper::seekWidgetByName(_widget, "middle_Button");
|
auto restartButton = Helper::seekWidgetByName(_widget, "middle_Button");
|
||||||
restartButton->setVisible(false);
|
restartButton->setVisible(false);
|
||||||
|
|
|
@ -355,7 +355,7 @@ bool UISliderNewEventCallbackTest::init()
|
||||||
_uiLayer->addChild(_displayValueLabel);
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
|
||||||
// Add the alert
|
// Add the alert
|
||||||
Text* alert = Text::create("See console ouput for Slider Down and Up event.","fonts/Marker Felt.ttf",20);
|
Text* alert = Text::create("See console output for Slider Down and Up event.", "fonts/Marker Felt.ttf", 20);
|
||||||
alert->setColor(Color3B(159, 168, 176));
|
alert->setColor(Color3B(159, 168, 176));
|
||||||
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||||
widgetSize.height / 2.0f - alert->getContentSize().height * 3.75f));
|
widgetSize.height / 2.0f - alert->getContentSize().height * 3.75f));
|
||||||
|
|
|
@ -228,7 +228,7 @@ bool UITextTest_IgnoreConentSize::init()
|
||||||
{
|
{
|
||||||
Size widgetSize = _widget->getContentSize();
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
Text* leftText = Text::create("ignore conent",
|
Text* leftText = Text::create("ignore content",
|
||||||
"fonts/Marker Felt.ttf",10);
|
"fonts/Marker Felt.ttf",10);
|
||||||
leftText->setPosition(Vec2(widgetSize.width / 2.0f - 50,
|
leftText->setPosition(Vec2(widgetSize.width / 2.0f - 50,
|
||||||
widgetSize.height / 2.0f));
|
widgetSize.height / 2.0f));
|
||||||
|
@ -240,7 +240,7 @@ bool UITextTest_IgnoreConentSize::init()
|
||||||
_uiLayer->addChild(leftText);
|
_uiLayer->addChild(leftText);
|
||||||
|
|
||||||
|
|
||||||
Text* rightText = Text::create("ignore conent",
|
Text* rightText = Text::create("ignore content",
|
||||||
"fonts/Marker Felt.ttf",10);
|
"fonts/Marker Felt.ttf",10);
|
||||||
rightText->setPosition(Vec2(widgetSize.width / 2.0f + 50,
|
rightText->setPosition(Vec2(widgetSize.width / 2.0f + 50,
|
||||||
widgetSize.height / 2.0f));
|
widgetSize.height / 2.0f));
|
||||||
|
@ -274,7 +274,7 @@ bool UITextTest_Clone::init()
|
||||||
{
|
{
|
||||||
Size widgetSize = _widget->getContentSize();
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
Text* singleText = Text::create("ignore conent",
|
Text* singleText = Text::create("ignore content",
|
||||||
"fonts/Marker Felt.ttf", 30);
|
"fonts/Marker Felt.ttf", 30);
|
||||||
singleText->setPosition(Vec2(widgetSize.width / 2.0f - 80,
|
singleText->setPosition(Vec2(widgetSize.width / 2.0f - 80,
|
||||||
widgetSize.height / 2.0f));
|
widgetSize.height / 2.0f));
|
||||||
|
|
|
@ -79,7 +79,7 @@ var UICheckBoxDefaultBehaviorTest = UIMainLayer.extend({
|
||||||
this._bottomDisplayLabel.setString("");
|
this._bottomDisplayLabel.setString("");
|
||||||
|
|
||||||
// Add the alert
|
// Add the alert
|
||||||
var alert = new ccui.Text("Only left two can be cliked!","Marker Felt",20 );
|
var alert = new ccui.Text("Only left two can be clicked!", "Marker Felt", 20);
|
||||||
alert.setColor(cc.color(159, 168, 176));
|
alert.setColor(cc.color(159, 168, 176));
|
||||||
alert.setPosition(cc.p(widgetSize.width / 2, widgetSize.height / 2 - alert.getContentSize().height * 1.75));
|
alert.setPosition(cc.p(widgetSize.width / 2, widgetSize.height / 2 - alert.getContentSize().height * 1.75));
|
||||||
this._mainNode.addChild(alert);
|
this._mainNode.addChild(alert);
|
||||||
|
|
|
@ -354,7 +354,7 @@ var UIPageViewTouchPropagationTest = UIMainLayer.extend({
|
||||||
|
|
||||||
// var eventListener = new cc.EventListenerTouchOneByOne();
|
// var eventListener = new cc.EventListenerTouchOneByOne();
|
||||||
// eventListener.onTouchBegan = function(touch, event){
|
// eventListener.onTouchBegan = function(touch, event){
|
||||||
// cc.log("layout recieves touches");
|
// cc.log("layout receives touches");
|
||||||
// return true;
|
// return true;
|
||||||
// };
|
// };
|
||||||
// this._eventDispatcher.addEventListenerWithSceneGraphPriority(eventListener, this);
|
// this._eventDispatcher.addEventListenerWithSceneGraphPriority(eventListener, this);
|
||||||
|
@ -738,7 +738,7 @@ var UIPageViewIndicatorTest = UIMainLayer.extend({
|
||||||
if(this._super()){
|
if(this._super()){
|
||||||
var widgetSize = this._widget.getContentSize();
|
var widgetSize = this._widget.getContentSize();
|
||||||
|
|
||||||
this._topDisplayLabel.setString("PageView indidcator custom texture\nscale : 0.5, index color: RED");
|
this._topDisplayLabel.setString("PageView indicator custom texture\nscale : 0.5, index color: RED");
|
||||||
this._topDisplayLabel.setFontSize(14);
|
this._topDisplayLabel.setFontSize(14);
|
||||||
this._topDisplayLabel.x = widgetSize.width / 2.0;
|
this._topDisplayLabel.x = widgetSize.width / 2.0;
|
||||||
this._topDisplayLabel.y = widgetSize.height / 2.0 + this._topDisplayLabel.height;
|
this._topDisplayLabel.y = widgetSize.height / 2.0 + this._topDisplayLabel.height;
|
||||||
|
|
|
@ -210,7 +210,7 @@ var UIRichTextXMLColor = UIMainLayer.extend({
|
||||||
|
|
||||||
// RichText
|
// RichText
|
||||||
var richText = new ccui.RichText();
|
var richText = new ccui.RichText();
|
||||||
richText.initWithXML("Defaul color.<font color='#ff0000'>red.<font color='#00ff00'>green</font>red again.</font>default again");
|
richText.initWithXML("Default color.<font color='#ff0000'>red.<font color='#00ff00'>green</font>red again.</font>default again");
|
||||||
|
|
||||||
richText.ignoreContentAdaptWithSize(false);
|
richText.ignoreContentAdaptWithSize(false);
|
||||||
richText.width = 120;
|
richText.width = 120;
|
||||||
|
|
|
@ -146,7 +146,7 @@ var UITextTest_IgnoreConentSize = UIMainLayer.extend({
|
||||||
|
|
||||||
this._bottomDisplayLabel.setString("");
|
this._bottomDisplayLabel.setString("");
|
||||||
|
|
||||||
var leftText = new ccui.Text("ignore conent", "Marker Felt",10);
|
var leftText = new ccui.Text("ignore content", "Marker Felt", 10);
|
||||||
leftText.setPosition(cc.p(widgetSize.width / 2 - 50,
|
leftText.setPosition(cc.p(widgetSize.width / 2 - 50,
|
||||||
widgetSize.height / 2));
|
widgetSize.height / 2));
|
||||||
leftText.ignoreContentAdaptWithSize(false);
|
leftText.ignoreContentAdaptWithSize(false);
|
||||||
|
@ -156,7 +156,7 @@ var UITextTest_IgnoreConentSize = UIMainLayer.extend({
|
||||||
leftText.setTouchEnabled(true);
|
leftText.setTouchEnabled(true);
|
||||||
this._mainNode.addChild(leftText);
|
this._mainNode.addChild(leftText);
|
||||||
|
|
||||||
var rightText = new ccui.Text("ignore conent", "Marker Felt",10);
|
var rightText = new ccui.Text("ignore content", "Marker Felt", 10);
|
||||||
rightText.setPosition(cc.p(widgetSize.width / 2 + 50,
|
rightText.setPosition(cc.p(widgetSize.width / 2 + 50,
|
||||||
widgetSize.height / 2));
|
widgetSize.height / 2));
|
||||||
rightText.setString("Text line with break\nText line with break\nText line with break\nText line with break\n");
|
rightText.setString("Text line with break\nText line with break\nText line with break\nText line with break\n");
|
||||||
|
|
Loading…
Reference in New Issue