From e2c7743db16c6c79147c8fbfea83a1850e117264 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Fri, 9 Jan 2015 18:51:30 +0800 Subject: [PATCH] Add test case --- .../Classes/LabelTest/LabelTestNew.cpp | 20 ++++++++++++++++++- .../Classes/LabelTest/LabelTestNew.h | 11 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index 232f355db5..8617d9e93b 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -83,7 +83,8 @@ static std::function createFunctions[] = CL(LabelAdditionalKerningTest), CL(LabelIssue8492Test), CL(LabelMultilineWithOutline), - CL(LabelIssue9255Test) + CL(LabelIssue9255Test), + CL(LabelSmallDimensionsTest) }; #define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) @@ -1877,3 +1878,20 @@ std::string LabelIssue9255Test::subtitle() const { return "switch to desktop and switch back. Crashed!!!"; } + +LabelSmallDimensionsTest::LabelSmallDimensionsTest() +{ + auto label = Label::createWithSystemFont("Hello World!", "fonts/arial.ttf", 24, Size(30,100)); + label->setPosition(VisibleRect::center()); + addChild(label); +} + +std::string LabelSmallDimensionsTest::title() const +{ + return "Test create Label[system font] with small dimensions"; +} + +std::string LabelSmallDimensionsTest::subtitle() const +{ + return "Program should not dead loop"; +} diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h index 0d83a93736..22dece7eed 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h @@ -544,5 +544,16 @@ public: virtual std::string subtitle() const override; }; +class LabelSmallDimensionsTest : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelSmallDimensionsTest); + + LabelSmallDimensionsTest(); + + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + #endif