axmol/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h

997 lines
23 KiB
C
Raw Normal View History

/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
2013-08-13 04:29:54 +08:00
#ifndef _ATLAS_TEST_NEW_H_
#define _ATLAS_TEST_NEW_H_
#include "../BaseTest.h"
2014-04-30 08:37:36 +08:00
#include "renderer/CCCustomCommand.h"
2014-03-11 17:13:54 +08:00
#include "ui/CocosGUI.h"
Add Label Overflow and wrap option. Squashed commit of the following: commit 7176582def3686f78701f92ead4d0976bccd115d Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 19 10:30:54 2015 +0800 add char map font test commit 7ea7c251ff549e4a74d5c5c3faa49893fe5defc4 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 15:00:17 2015 +0800 system font overflow is not supported commit a02fe0c7f94692b95a0bfd6f194a94c4519cee3a Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 11:04:15 2015 +0800 add system font test commit eb098da8b16f485c86929a9b2ba00a64068264e9 Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 17 10:29:35 2015 +0800 Finish resize height mode commit ca78ba35abdbacc23bf6f8315454ec0a356a6aca Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 16 11:01:27 2015 +0800 fix wrap issue commit baf1a5e0dc3a08da0a13500aea5afc82017b054a Author: zilongshanren <guanghui8827@126.com> Date: Sat Nov 14 08:28:57 2015 +0800 horizontal shrink still has a issue commit 7e8abc0990cdf299d23c8072c5c1d4aa561bf798 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 11:42:34 2015 +0800 finish shrink without wrap commit c9c45bd1f304ba00a6f9a274fa5631659a075bc1 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 10:09:46 2015 +0800 update shrink commit ad82010ea846679e4d1a09f5127be29ae2e6adae Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 12 17:55:15 2015 +0800 refactor shrink logic commit effc1ee1cd9f06eaa4f46dd5c2a1401f6a285af6 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 18:25:34 2015 +0800 add resize overflow type commit 194d552adc2a4ba2c439eff969b082556315e0ae Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 11:49:51 2015 +0800 no wrap, shrink is working. commit e2222ef14d5392817bd727895b3c2caec5ce4faf Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 10 16:16:27 2015 +0800 add overflow type to label. 1. optimize the testcase commit b65e2de4bfb3cb86a0d0cfa118be891a3f9fe858 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:22:34 2015 +0800 finish bmfont wrap by char commit f339ff0309dc9e2ca2871f03f4551d329afce5e1 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:04:51 2015 +0800 finish bmfont wrap by word commit 4c8edc65204a1294ac81315e72f1299acbdf43c0 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 11:29:21 2015 +0800 add BMFont size support commit 3282481bda9dcb0f88b41f2568f7e5c856af6d53 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 09:58:01 2015 +0800 add font size support for BMFONT commit 0c8e2a0374983625507a183cb2eb53a0b1709e25 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 16:36:27 2015 +0800 add toggle wrap option. 1. make hirozontal clamp working commit 19dcd3e80a34c54b20934d08937eb270e689a7db Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 15:12:59 2015 +0800 tweak label layout commit e36a40babf4817ea7e9830614ac7560f2e69c583 Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 5 11:11:02 2015 +0800 finish the test skeleton commit a144a3a5d388d15c4f37cbfc12563eccabffb8e1 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 16:38:54 2015 +0800 add setFontSize api to label. 1. add new chinese-english bmfont 2. beautify base test commit b22551c9eb3738fbb1c38ae4a3bfd07a202dcaf0 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 11:27:18 2015 +0800 add label layout test skeleton
2015-11-19 16:06:13 +08:00
#include "extensions/cocos-ext.h"
#include "editor-support/cocostudio/LocalizationManager.h"
2013-08-13 04:29:54 +08:00
DEFINE_TEST_SUITE(NewLabelTests);
2013-08-13 04:29:54 +08:00
class AtlasDemoNew : public TestCase
2013-08-13 04:29:54 +08:00
{
};
class LabelFNTColorAndOpacity : public AtlasDemoNew
{
float _time;
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTColorAndOpacity);
2013-08-13 04:29:54 +08:00
LabelFNTColorAndOpacity();
virtual void step(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTSpriteActions : public AtlasDemoNew
{
float _time;
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTSpriteActions);
2013-08-13 04:29:54 +08:00
LabelFNTSpriteActions();
virtual void step(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTPadding : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTPadding);
2013-08-13 04:29:54 +08:00
LabelFNTPadding();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTOffset : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTOffset);
2013-08-13 04:29:54 +08:00
LabelFNTOffset();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTColor : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTColor);
2013-08-13 04:29:54 +08:00
LabelFNTColor();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelFNTOpacity : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelFNTOpacity);
LabelFNTOpacity();
virtual std::string title() const override;
2013-08-13 04:29:54 +08:00
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTHundredLabels : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTHundredLabels);
2013-08-13 04:29:54 +08:00
LabelFNTHundredLabels();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTMultiLine : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTMultiLine);
2013-08-13 04:29:54 +08:00
LabelFNTMultiLine();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTandTTFEmpty : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTandTTFEmpty);
2013-08-13 04:29:54 +08:00
LabelFNTandTTFEmpty();
void updateStrings(float dt);
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
private:
bool setEmpty;
};
class LabelFNTRetina : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTRetina);
2013-08-13 04:29:54 +08:00
LabelFNTRetina();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTGlyphDesigner : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTGlyphDesigner);
2013-08-13 04:29:54 +08:00
LabelFNTGlyphDesigner();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTMultiLineAlignment : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTMultiLineAlignment);
virtual bool init() override;
2013-08-13 04:29:54 +08:00
void snapArrowsToEdge();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void stringChanged(cocos2d::Ref* sender);
void alignmentChanged(cocos2d::Ref* sender);
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
void selectAlignmentItem(cocos2d::MenuItemFont* item);
void selectSentenceItem(cocos2d::MenuItemFont* item);
virtual std::string getItemString(cocos2d::MenuItemFont* item);
2013-08-13 04:29:54 +08:00
protected:
cocos2d::Label* _label = nullptr;
cocos2d::Sprite* _arrowsBar = nullptr;
cocos2d::Sprite* _arrows = nullptr;
std::vector<cocos2d::MenuItemFont*> _menuItems;
cocos2d::MenuItemFont *_lastSentenceItem = nullptr;
cocos2d::MenuItemFont *_lastAlignmentItem = nullptr;
bool _drag = false;
};
class LabelFNTMultiLineAlignmentUNICODE : public LabelFNTMultiLineAlignment
{
2013-08-13 04:29:54 +08:00
public:
CREATE_FUNC(LabelFNTMultiLineAlignmentUNICODE);
bool init() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
virtual std::string getItemString(cocos2d::MenuItemFont* item) override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTUNICODELanguages : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTUNICODELanguages);
2013-08-13 04:29:54 +08:00
LabelFNTUNICODELanguages();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFNTBounds : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFNTBounds);
2013-08-13 04:29:54 +08:00
LabelFNTBounds();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelTTFLongLineWrapping : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelTTFLongLineWrapping);
2013-08-13 04:29:54 +08:00
LabelTTFLongLineWrapping();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelTTFColor : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelTTFColor);
2013-08-13 04:29:54 +08:00
LabelTTFColor();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelTTFUnicodeNew : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelTTFUnicodeNew);
2013-08-13 04:29:54 +08:00
LabelTTFUnicodeNew();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelTTFDynamicAlignment : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelTTFDynamicAlignment);
2013-08-13 04:29:54 +08:00
LabelTTFDynamicAlignment();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
private:
void setAlignmentLeft(cocos2d::Ref* sender);
void setAlignmentCenter(cocos2d::Ref* sender);
void setAlignmentRight(cocos2d::Ref* sender);
2013-08-13 04:29:54 +08:00
void updateAlignment();
cocos2d::Label* _label;
cocos2d::TextHAlignment _horizAlign;
2013-08-13 04:29:54 +08:00
};
class LabelTTFEmoji : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelTTFEmoji);
LabelTTFEmoji();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2013-08-13 04:29:54 +08:00
2014-02-08 17:14:38 +08:00
class LabelTTFCJKWrappingTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelTTFCJKWrappingTest);
LabelTTFCJKWrappingTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
private:
};
2013-08-13 04:29:54 +08:00
class LabelTTFFontsTestNew : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelTTFFontsTestNew);
2013-08-13 04:29:54 +08:00
LabelTTFFontsTestNew();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
};
class LabelFontDefTestNew : public AtlasDemoNew
{
public:
2013-11-14 09:36:33 +08:00
CREATE_FUNC(LabelFontDefTestNew);
2013-08-13 04:29:54 +08:00
LabelFontDefTestNew();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-08-13 04:29:54 +08:00
private:
};
class LabelTTFDistanceField : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelTTFDistanceField);
LabelTTFDistanceField();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelOutlineAndGlowTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelOutlineAndGlowTest);
LabelOutlineAndGlowTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2013-08-13 04:29:54 +08:00
class LabelShadowTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelShadowTest);
LabelShadowTest();
virtual void onEnter() override;
virtual std::string title() const override;
virtual std::string subtitle() const override;
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
private:
cocos2d::Label* shadowLabelOutline;
cocos2d::Label* shadowLabelTTF;
cocos2d::Label* shadowLabelGrow;
cocos2d::Label* shadowLabelBMFont;
};
class LabelCharMapTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelCharMapTest);
LabelCharMapTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void step(float dt);
private:
float _time;
};
2014-01-24 15:02:42 +08:00
class LabelCharMapColorTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelCharMapColorTest);
LabelCharMapColorTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void step(float dt);
void actionFinishCallback();
private:
float _time;
};
class LabelCrashTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelCrashTest);
LabelCrashTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2013-08-13 04:29:54 +08:00
2014-01-23 16:16:30 +08:00
class LabelTTFOldNew : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelTTFOldNew);
LabelTTFOldNew();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelFontNameTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelFontNameTest);
LabelFontNameTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelAlignmentTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelAlignmentTest);
LabelAlignmentTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
private:
void setAlignmentLeft(cocos2d::Ref* sender);
void setAlignmentCenter(cocos2d::Ref* sender);
void setAlignmentRight(cocos2d::Ref* sender);
void setAlignmentTop(cocos2d::Ref* sender);
void setAlignmentMiddle(cocos2d::Ref* sender);
void setAlignmentBottom(cocos2d::Ref* sender);
cocos2d::Label* _label;
};
2014-03-18 10:26:45 +08:00
class LabelIssue4428Test : public AtlasDemoNew
{
public:
2014-03-18 10:26:45 +08:00
CREATE_FUNC(LabelIssue4428Test);
2014-03-18 10:26:45 +08:00
LabelIssue4428Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue4999Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue4999Test);
LabelIssue4999Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2014-06-18 18:01:55 +08:00
class LabelLineHeightTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelLineHeightTest);
LabelLineHeightTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
2014-06-18 18:01:55 +08:00
private:
cocos2d::Label* label;
2014-06-18 18:01:55 +08:00
};
class LabelAdditionalKerningTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelAdditionalKerningTest);
LabelAdditionalKerningTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
2014-06-18 18:01:55 +08:00
private:
cocos2d::Label* label;
2014-06-18 18:01:55 +08:00
};
class LabelIssue8492Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue8492Test);
LabelIssue8492Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelMultilineWithOutline : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelMultilineWithOutline);
LabelMultilineWithOutline();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2013-08-13 04:29:54 +08:00
// we don't support linebreak mode
2014-11-27 11:03:11 +08:00
class LabelIssue9255Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue9255Test);
LabelIssue9255Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2015-01-09 18:51:30 +08:00
class LabelSmallDimensionsTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelSmallDimensionsTest);
LabelSmallDimensionsTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2015-01-20 12:01:51 +08:00
class LabelIssue10089Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue10089Test);
LabelIssue10089Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelSystemFontColor : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelSystemFontColor);
LabelSystemFontColor();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2014-11-27 11:03:11 +08:00
2015-04-30 16:11:59 +08:00
class LabelIssue10773Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue10773Test);
LabelIssue10773Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2015-05-07 11:48:55 +08:00
class LabelIssue11576Test : public AtlasDemoNew
2015-05-04 10:09:14 +08:00
{
public:
2015-05-07 11:48:55 +08:00
CREATE_FUNC(LabelIssue11576Test);
2015-05-04 10:09:14 +08:00
2015-05-07 11:48:55 +08:00
LabelIssue11576Test();
2015-05-04 10:09:14 +08:00
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue11699Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue11699Test);
LabelIssue11699Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue12409Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue12409Test);
LabelIssue12409Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
2015-07-07 15:41:54 +08:00
class LabelAddChildTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelAddChildTest);
LabelAddChildTest();
virtual std::string title() const override;
};
2015-07-13 15:38:33 +08:00
class LabelIssue12775Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue12775Test);
LabelIssue12775Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue11585Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue11585Test);
LabelIssue11585Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue10688Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue10688Test);
LabelIssue10688Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue13202Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue13202Test);
LabelIssue13202Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue9500Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue9500Test);
LabelIssue9500Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
Add Label Overflow and wrap option. Squashed commit of the following: commit 7176582def3686f78701f92ead4d0976bccd115d Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 19 10:30:54 2015 +0800 add char map font test commit 7ea7c251ff549e4a74d5c5c3faa49893fe5defc4 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 15:00:17 2015 +0800 system font overflow is not supported commit a02fe0c7f94692b95a0bfd6f194a94c4519cee3a Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 11:04:15 2015 +0800 add system font test commit eb098da8b16f485c86929a9b2ba00a64068264e9 Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 17 10:29:35 2015 +0800 Finish resize height mode commit ca78ba35abdbacc23bf6f8315454ec0a356a6aca Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 16 11:01:27 2015 +0800 fix wrap issue commit baf1a5e0dc3a08da0a13500aea5afc82017b054a Author: zilongshanren <guanghui8827@126.com> Date: Sat Nov 14 08:28:57 2015 +0800 horizontal shrink still has a issue commit 7e8abc0990cdf299d23c8072c5c1d4aa561bf798 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 11:42:34 2015 +0800 finish shrink without wrap commit c9c45bd1f304ba00a6f9a274fa5631659a075bc1 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 10:09:46 2015 +0800 update shrink commit ad82010ea846679e4d1a09f5127be29ae2e6adae Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 12 17:55:15 2015 +0800 refactor shrink logic commit effc1ee1cd9f06eaa4f46dd5c2a1401f6a285af6 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 18:25:34 2015 +0800 add resize overflow type commit 194d552adc2a4ba2c439eff969b082556315e0ae Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 11:49:51 2015 +0800 no wrap, shrink is working. commit e2222ef14d5392817bd727895b3c2caec5ce4faf Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 10 16:16:27 2015 +0800 add overflow type to label. 1. optimize the testcase commit b65e2de4bfb3cb86a0d0cfa118be891a3f9fe858 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:22:34 2015 +0800 finish bmfont wrap by char commit f339ff0309dc9e2ca2871f03f4551d329afce5e1 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:04:51 2015 +0800 finish bmfont wrap by word commit 4c8edc65204a1294ac81315e72f1299acbdf43c0 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 11:29:21 2015 +0800 add BMFont size support commit 3282481bda9dcb0f88b41f2568f7e5c856af6d53 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 09:58:01 2015 +0800 add font size support for BMFONT commit 0c8e2a0374983625507a183cb2eb53a0b1709e25 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 16:36:27 2015 +0800 add toggle wrap option. 1. make hirozontal clamp working commit 19dcd3e80a34c54b20934d08937eb270e689a7db Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 15:12:59 2015 +0800 tweak label layout commit e36a40babf4817ea7e9830614ac7560f2e69c583 Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 5 11:11:02 2015 +0800 finish the test skeleton commit a144a3a5d388d15c4f37cbfc12563eccabffb8e1 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 16:38:54 2015 +0800 add setFontSize api to label. 1. add new chinese-english bmfont 2. beautify base test commit b22551c9eb3738fbb1c38ae4a3bfd07a202dcaf0 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 11:27:18 2015 +0800 add label layout test skeleton
2015-11-19 16:06:13 +08:00
class LabelLayoutBaseTest : public AtlasDemoNew
{
public:
LabelLayoutBaseTest();
void updateDrawNodeSize(const cocos2d::Size &drawNodeSize);
cocos2d::extension::ControlStepper* makeControlStepper();
void valueChanged(cocos2d::Ref* sender, cocos2d::extension::Control::EventType controlEvent);
protected:
void setAlignmentLeft(cocos2d::Ref* sender);
void setAlignmentCenter(cocos2d::Ref* sender);
void setAlignmentRight(cocos2d::Ref* sender);
void setAlignmentTop(cocos2d::Ref* sender);
void setAlignmentMiddle(cocos2d::Ref* sender);
void setAlignmentBottom(cocos2d::Ref* sender);
void initWrapOption(const cocos2d::Size& size);
void initToggleLabelTypeOption(const cocos2d::Size& size);
void initAlignmentOption(const cocos2d::Size& size);
void initFontSizeChange(const cocos2d::Size& size);
void initSliders(const cocos2d::Size& size);
void initTestLabel(const cocos2d::Size& size);
void initDrawNode(const cocos2d::Size& size);
cocos2d::DrawNode* _drawNode;
cocos2d::Label* _label;
int _labelType;
};
class LabelWrapByWordTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelWrapByWordTest);
LabelWrapByWordTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelWrapByCharTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelWrapByCharTest);
LabelWrapByCharTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelWrapNoBreakSpaceTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelWrapNoBreakSpaceTest);
LabelWrapNoBreakSpaceTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
Add Label Overflow and wrap option. Squashed commit of the following: commit 7176582def3686f78701f92ead4d0976bccd115d Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 19 10:30:54 2015 +0800 add char map font test commit 7ea7c251ff549e4a74d5c5c3faa49893fe5defc4 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 15:00:17 2015 +0800 system font overflow is not supported commit a02fe0c7f94692b95a0bfd6f194a94c4519cee3a Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 11:04:15 2015 +0800 add system font test commit eb098da8b16f485c86929a9b2ba00a64068264e9 Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 17 10:29:35 2015 +0800 Finish resize height mode commit ca78ba35abdbacc23bf6f8315454ec0a356a6aca Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 16 11:01:27 2015 +0800 fix wrap issue commit baf1a5e0dc3a08da0a13500aea5afc82017b054a Author: zilongshanren <guanghui8827@126.com> Date: Sat Nov 14 08:28:57 2015 +0800 horizontal shrink still has a issue commit 7e8abc0990cdf299d23c8072c5c1d4aa561bf798 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 11:42:34 2015 +0800 finish shrink without wrap commit c9c45bd1f304ba00a6f9a274fa5631659a075bc1 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 10:09:46 2015 +0800 update shrink commit ad82010ea846679e4d1a09f5127be29ae2e6adae Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 12 17:55:15 2015 +0800 refactor shrink logic commit effc1ee1cd9f06eaa4f46dd5c2a1401f6a285af6 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 18:25:34 2015 +0800 add resize overflow type commit 194d552adc2a4ba2c439eff969b082556315e0ae Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 11:49:51 2015 +0800 no wrap, shrink is working. commit e2222ef14d5392817bd727895b3c2caec5ce4faf Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 10 16:16:27 2015 +0800 add overflow type to label. 1. optimize the testcase commit b65e2de4bfb3cb86a0d0cfa118be891a3f9fe858 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:22:34 2015 +0800 finish bmfont wrap by char commit f339ff0309dc9e2ca2871f03f4551d329afce5e1 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:04:51 2015 +0800 finish bmfont wrap by word commit 4c8edc65204a1294ac81315e72f1299acbdf43c0 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 11:29:21 2015 +0800 add BMFont size support commit 3282481bda9dcb0f88b41f2568f7e5c856af6d53 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 09:58:01 2015 +0800 add font size support for BMFONT commit 0c8e2a0374983625507a183cb2eb53a0b1709e25 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 16:36:27 2015 +0800 add toggle wrap option. 1. make hirozontal clamp working commit 19dcd3e80a34c54b20934d08937eb270e689a7db Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 15:12:59 2015 +0800 tweak label layout commit e36a40babf4817ea7e9830614ac7560f2e69c583 Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 5 11:11:02 2015 +0800 finish the test skeleton commit a144a3a5d388d15c4f37cbfc12563eccabffb8e1 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 16:38:54 2015 +0800 add setFontSize api to label. 1. add new chinese-english bmfont 2. beautify base test commit b22551c9eb3738fbb1c38ae4a3bfd07a202dcaf0 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 11:27:18 2015 +0800 add label layout test skeleton
2015-11-19 16:06:13 +08:00
class LabelShrinkByWordTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelShrinkByWordTest);
LabelShrinkByWordTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelShrinkByCharTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelShrinkByCharTest);
LabelShrinkByCharTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelResizeTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelResizeTest);
LabelResizeTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelToggleTypeTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelToggleTypeTest);
LabelToggleTypeTest();
void initToggleCheckboxes();
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton,cocos2d::ui::RadioButton::EventType type);
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelSystemFontTest : public LabelLayoutBaseTest
{
public:
CREATE_FUNC(LabelSystemFontTest);
LabelSystemFontTest();
void initToggleCheckboxes();
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton,cocos2d::ui::RadioButton::EventType type);
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelCharMapFontTest : public LabelLayoutBaseTest
Add Label Overflow and wrap option. Squashed commit of the following: commit 7176582def3686f78701f92ead4d0976bccd115d Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 19 10:30:54 2015 +0800 add char map font test commit 7ea7c251ff549e4a74d5c5c3faa49893fe5defc4 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 15:00:17 2015 +0800 system font overflow is not supported commit a02fe0c7f94692b95a0bfd6f194a94c4519cee3a Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 18 11:04:15 2015 +0800 add system font test commit eb098da8b16f485c86929a9b2ba00a64068264e9 Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 17 10:29:35 2015 +0800 Finish resize height mode commit ca78ba35abdbacc23bf6f8315454ec0a356a6aca Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 16 11:01:27 2015 +0800 fix wrap issue commit baf1a5e0dc3a08da0a13500aea5afc82017b054a Author: zilongshanren <guanghui8827@126.com> Date: Sat Nov 14 08:28:57 2015 +0800 horizontal shrink still has a issue commit 7e8abc0990cdf299d23c8072c5c1d4aa561bf798 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 11:42:34 2015 +0800 finish shrink without wrap commit c9c45bd1f304ba00a6f9a274fa5631659a075bc1 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 13 10:09:46 2015 +0800 update shrink commit ad82010ea846679e4d1a09f5127be29ae2e6adae Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 12 17:55:15 2015 +0800 refactor shrink logic commit effc1ee1cd9f06eaa4f46dd5c2a1401f6a285af6 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 18:25:34 2015 +0800 add resize overflow type commit 194d552adc2a4ba2c439eff969b082556315e0ae Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 11 11:49:51 2015 +0800 no wrap, shrink is working. commit e2222ef14d5392817bd727895b3c2caec5ce4faf Author: zilongshanren <guanghui8827@126.com> Date: Tue Nov 10 16:16:27 2015 +0800 add overflow type to label. 1. optimize the testcase commit b65e2de4bfb3cb86a0d0cfa118be891a3f9fe858 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:22:34 2015 +0800 finish bmfont wrap by char commit f339ff0309dc9e2ca2871f03f4551d329afce5e1 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 17:04:51 2015 +0800 finish bmfont wrap by word commit 4c8edc65204a1294ac81315e72f1299acbdf43c0 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 11:29:21 2015 +0800 add BMFont size support commit 3282481bda9dcb0f88b41f2568f7e5c856af6d53 Author: zilongshanren <guanghui8827@126.com> Date: Mon Nov 9 09:58:01 2015 +0800 add font size support for BMFONT commit 0c8e2a0374983625507a183cb2eb53a0b1709e25 Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 16:36:27 2015 +0800 add toggle wrap option. 1. make hirozontal clamp working commit 19dcd3e80a34c54b20934d08937eb270e689a7db Author: zilongshanren <guanghui8827@126.com> Date: Fri Nov 6 15:12:59 2015 +0800 tweak label layout commit e36a40babf4817ea7e9830614ac7560f2e69c583 Author: zilongshanren <guanghui8827@126.com> Date: Thu Nov 5 11:11:02 2015 +0800 finish the test skeleton commit a144a3a5d388d15c4f37cbfc12563eccabffb8e1 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 16:38:54 2015 +0800 add setFontSize api to label. 1. add new chinese-english bmfont 2. beautify base test commit b22551c9eb3738fbb1c38ae4a3bfd07a202dcaf0 Author: zilongshanren <guanghui8827@126.com> Date: Wed Nov 4 11:27:18 2015 +0800 add label layout test skeleton
2015-11-19 16:06:13 +08:00
{
public:
CREATE_FUNC(LabelCharMapFontTest);
LabelCharMapFontTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue13846Test : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue13846Test);
LabelIssue13846Test();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
Adds xml support in UIRichText Supported tags: - <small>: makes the font 20% smaller - <big>: makes the font 25% bigger - <img src="" />: to add an image - <font face="path to font" size="size" color="#00ffaa">: font attributes - <i>: italics - <b>: bold - <u>: underline - <del> strike-through - </br>: new line Also adds support for strikethrough, italics, bold and underlie to `Label` Contains tests for UIRichText and Label Squashed commit of the following: commit a0d6ae0513d40dbf414930210ab032a49d8984a0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Jan 19 20:39:21 2016 -0800 cleanup LabelTestNew commit 0cf423af85d88a42fc1317207feeb3d05da7f8ab Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Jan 19 20:34:53 2016 -0800 adds maaaany tests ...and fixes width and height in <img src=""> commit e8ba6acd5d79bbc766d7aa02ef166e166c801d01 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Jan 15 19:41:37 2016 -0800 Label + URL working Ok commit 36689e29ee3d77310e92264a09084cc06e30664c Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Jan 15 18:24:44 2016 -0800 adding this code just in case... ... should use a listener component instead commit af03708950e74483b875d0baad593aa6ed242a04 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Jan 14 20:23:36 2016 -0800 URL node plus <de><u> and <a img commit e3a4930b012c0b3756752dac6ffb5ad43d24ae99 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed Jan 13 18:42:18 2016 -0800 strikethrough and underline implemented they support multiline and horizontal alignment as well includes test however vertical alignment might not work commit 640ccf39f56e153db46785a61be7000e898174c7 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Jan 12 18:14:57 2016 -0800 bug fixes commit 5e41fb76e91c571639585a609a255eb41797a302 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Jan 12 16:47:20 2016 -0800 adds italics and bold "disable test" commit 202c5a45bb9c8ea160b9f6880ef858874e07814b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Jan 12 14:40:13 2016 -0800 adds italics test commit d1a8b421445053cc36860fc376f52692a3672dfe Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Jan 11 20:53:23 2016 -0800 italics is working ok commit fdd02087fce920c27c2409301ec88685fe68085b Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Fri Jan 8 17:18:56 2016 -0800 color, size and face working commit c01bdef6b1d49f8805b69d4c162b74cd00c8f5b3 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Thu Jan 7 19:02:16 2016 -0800 initial commit
2016-01-20 12:41:31 +08:00
class LabelRichText : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelRichText);
LabelRichText();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelItalics : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelItalics);
LabelItalics();
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1a;
cocos2d::Label* _label2a;
};
class LabelBold : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelBold);
LabelBold();
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1a;
cocos2d::Label* _label2a;
};
class LabelUnderline : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelUnderline);
LabelUnderline();
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1a;
cocos2d::Label* _label2a;
};
class LabelUnderlineMultiline : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelUnderlineMultiline);
LabelUnderlineMultiline();
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1a;
cocos2d::Label* _label2a;
};
class LabelStrikethrough : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelStrikethrough);
LabelStrikethrough();
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1a;
cocos2d::Label* _label2a;
};
class LabelLocalizationTest : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelLocalizationTest);
LabelLocalizationTest();
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton, cocos2d::ui::RadioButton::EventType type);
virtual std::string title() const override;
virtual std::string subtitle() const override;
cocos2d::Label* _label1;
cocos2d::Label* _label2;
cocostudio::ILocalizationManager* _localizationJson;
cocostudio::ILocalizationManager* _localizationBin;
};
class LabelIssue15214 : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue15214);
LabelIssue15214();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue16293 : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue16293);
LabelIssue16293();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue16471 : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue16471);
LabelIssue16471();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue16717 : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue16717);
LabelIssue16717();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssueLineGap : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssueLineGap);
LabelIssueLineGap();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelIssue17902 : public AtlasDemoNew
{
public:
CREATE_FUNC(LabelIssue17902);
LabelIssue17902();
virtual void purgeCachedData();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class LabelLetterColorsTest : public AtlasDemoNew {
public:
CREATE_FUNC(LabelLetterColorsTest);
LabelLetterColorsTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
private:
static void setLetterColors(cocos2d::Label* label, const cocos2d::Color3B& color);
};
2013-08-13 04:29:54 +08:00
#endif