mirror of https://github.com/axmolengine/axmol.git
Add test case
This commit is contained in:
parent
158d96046e
commit
581f1ab42b
|
@ -26,6 +26,7 @@
|
||||||
#include "2d/CCLabel.h"
|
#include "2d/CCLabel.h"
|
||||||
#include "2d/CCFontAtlasCache.h"
|
#include "2d/CCFontAtlasCache.h"
|
||||||
#include "2d/CCSprite.h"
|
#include "2d/CCSprite.h"
|
||||||
|
#include "2d/CCSpriteBatchNode.h"
|
||||||
#include "2d/CCLabelTextFormatter.h"
|
#include "2d/CCLabelTextFormatter.h"
|
||||||
#include "base/ccUTF8.h"
|
#include "base/ccUTF8.h"
|
||||||
#include "platform/CCFileUtils.h"
|
#include "platform/CCFileUtils.h"
|
||||||
|
|
|
@ -80,6 +80,7 @@ NewLabelTests::NewLabelTests()
|
||||||
ADD_TEST_CASE(LabelIssue11699Test);
|
ADD_TEST_CASE(LabelIssue11699Test);
|
||||||
ADD_TEST_CASE(LabelIssue12259Test);
|
ADD_TEST_CASE(LabelIssue12259Test);
|
||||||
ADD_TEST_CASE(LabelIssue12409Test);
|
ADD_TEST_CASE(LabelIssue12409Test);
|
||||||
|
ADD_TEST_CASE(LabelAddChildTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
LabelTTFAlignmentNew::LabelTTFAlignmentNew()
|
LabelTTFAlignmentNew::LabelTTFAlignmentNew()
|
||||||
|
@ -2011,3 +2012,26 @@ std::string LabelIssue12409Test::subtitle() const
|
||||||
{
|
{
|
||||||
return "Testing auto-wrapping without space.";
|
return "Testing auto-wrapping without space.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LabelAddChildTest::LabelAddChildTest()
|
||||||
|
{
|
||||||
|
auto center = VisibleRect::center();
|
||||||
|
|
||||||
|
auto label = Label::createWithTTF("Label with child node:", "fonts/arial.ttf", 24);
|
||||||
|
label->setPosition(center.x, center.y);
|
||||||
|
addChild(label);
|
||||||
|
|
||||||
|
auto jump = JumpBy::create(1.0f, Vec2::ZERO, 60, 1);
|
||||||
|
auto jump_4ever = RepeatForever::create(jump);
|
||||||
|
label->runAction(jump_4ever);
|
||||||
|
|
||||||
|
auto spite = Sprite::create("Images/SpookyPeas.png");
|
||||||
|
spite->setAnchorPoint(Vec2::ANCHOR_MIDDLE_LEFT);
|
||||||
|
spite->setPosition(label->getContentSize().width, label->getContentSize().height/2);
|
||||||
|
label->addChild(spite);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelAddChildTest::title() const
|
||||||
|
{
|
||||||
|
return "Label support add child nodes";
|
||||||
|
}
|
||||||
|
|
|
@ -609,4 +609,14 @@ public:
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LabelAddChildTest : public AtlasDemoNew
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(LabelAddChildTest);
|
||||||
|
|
||||||
|
LabelAddChildTest();
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue