2013-09-16 20:54:13 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013 cocos2d-x.org
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
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:
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __TestCpp__UIButtonTest__
|
|
|
|
#define __TestCpp__UIButtonTest__
|
|
|
|
|
|
|
|
#include "../UIScene.h"
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
DEFINE_TEST_SUITE(UIButtonTests);
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
class UIButtonTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTest);
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
UIButtonTest();
|
|
|
|
~UIButtonTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2013-09-16 20:54:13 +08:00
|
|
|
|
2022-10-18 19:17:36 +08:00
|
|
|
void printWidgetResources(ax::Ref* sender);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
|
|
|
ax::ui::Button* _button;
|
2013-09-16 20:54:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UIButtonTest_Scale9 : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTest_Scale9);
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
UIButtonTest_Scale9();
|
|
|
|
~UIButtonTest_Scale9();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2013-09-16 20:54:13 +08:00
|
|
|
};
|
|
|
|
|
2015-01-20 20:57:54 +08:00
|
|
|
class UIButtonTest_Scale9_State_Change : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTest_Scale9_State_Change);
|
|
|
|
|
2015-01-20 20:57:54 +08:00
|
|
|
UIButtonTest_Scale9_State_Change();
|
|
|
|
~UIButtonTest_Scale9_State_Change();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-01-20 20:57:54 +08:00
|
|
|
|
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2015-01-20 20:57:54 +08:00
|
|
|
};
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
class UIButtonTest_PressedAction : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTest_PressedAction);
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
UIButtonTest_PressedAction();
|
|
|
|
~UIButtonTest_PressedAction();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UIButtonTest_Title : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTest_Title);
|
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
UIButtonTest_Title();
|
|
|
|
~UIButtonTest_Title();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2013-09-16 20:54:13 +08:00
|
|
|
};
|
|
|
|
|
2014-07-25 14:40:58 +08:00
|
|
|
class UIButtonTestRemoveSelf : public UIScene
|
2014-07-23 18:52:03 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTestRemoveSelf);
|
|
|
|
|
2014-07-25 14:40:58 +08:00
|
|
|
UIButtonTestRemoveSelf();
|
|
|
|
~UIButtonTestRemoveSelf();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-07-23 18:52:03 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-07-23 18:52:03 +08:00
|
|
|
};
|
|
|
|
|
2014-07-31 11:07:20 +08:00
|
|
|
class UIButtonTestSwitchScale9 : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTestSwitchScale9);
|
|
|
|
|
2014-07-31 11:07:20 +08:00
|
|
|
UIButtonTestSwitchScale9();
|
|
|
|
~UIButtonTestSwitchScale9();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-07-31 11:07:20 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-07-31 11:07:20 +08:00
|
|
|
};
|
|
|
|
|
2014-08-14 11:14:24 +08:00
|
|
|
class UIButtonTestZoomScale : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTestZoomScale);
|
|
|
|
|
2014-08-14 11:14:24 +08:00
|
|
|
UIButtonTestZoomScale();
|
|
|
|
~UIButtonTestZoomScale();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void sliderEvent(ax::Ref* sender, ax::ui::Slider::EventType type);
|
2014-08-14 11:14:24 +08:00
|
|
|
|
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-08-14 11:14:24 +08:00
|
|
|
};
|
|
|
|
|
2014-09-12 13:50:13 +08:00
|
|
|
class UIButtonTextOnly : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTextOnly);
|
|
|
|
|
2014-09-12 13:50:13 +08:00
|
|
|
UIButtonTextOnly();
|
|
|
|
~UIButtonTextOnly();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2014-09-12 13:50:13 +08:00
|
|
|
|
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-09-12 13:50:13 +08:00
|
|
|
};
|
2014-09-12 14:24:27 +08:00
|
|
|
|
|
|
|
class UIButtonIgnoreContentSizeTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonIgnoreContentSizeTest);
|
|
|
|
|
2014-09-12 14:24:27 +08:00
|
|
|
UIButtonIgnoreContentSizeTest();
|
|
|
|
~UIButtonIgnoreContentSizeTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-09-12 14:24:27 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-09-12 14:24:27 +08:00
|
|
|
};
|
2014-09-17 10:57:40 +08:00
|
|
|
|
|
|
|
class UIButtonTitleEffectTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonTitleEffectTest);
|
|
|
|
|
2014-09-17 10:57:40 +08:00
|
|
|
UIButtonTitleEffectTest();
|
|
|
|
~UIButtonTitleEffectTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-09-17 10:57:40 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-09-17 10:57:40 +08:00
|
|
|
};
|
2014-11-05 20:50:13 +08:00
|
|
|
|
|
|
|
class UIButtonFlipTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonFlipTest);
|
|
|
|
|
2014-11-05 20:50:13 +08:00
|
|
|
UIButtonFlipTest();
|
|
|
|
~UIButtonFlipTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-11-05 20:50:13 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-11-05 20:50:13 +08:00
|
|
|
};
|
2014-12-23 15:03:31 +08:00
|
|
|
|
|
|
|
class UIButtonNormalDefaultTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonNormalDefaultTest);
|
|
|
|
|
2014-12-23 15:03:31 +08:00
|
|
|
UIButtonNormalDefaultTest();
|
|
|
|
~UIButtonNormalDefaultTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2015-04-16 14:38:00 +08:00
|
|
|
|
2014-12-23 15:03:31 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-12-23 15:03:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UIButtonDisableDefaultTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UIButtonDisableDefaultTest);
|
|
|
|
|
2014-12-23 15:03:31 +08:00
|
|
|
UIButtonDisableDefaultTest();
|
|
|
|
~UIButtonDisableDefaultTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
virtual bool init() override;
|
2015-04-16 14:38:00 +08:00
|
|
|
|
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2015-04-16 14:38:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UIButtonCloneTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(UIButtonCloneTest);
|
|
|
|
|
|
|
|
UIButtonCloneTest();
|
|
|
|
~UIButtonCloneTest();
|
|
|
|
|
|
|
|
virtual bool init() override;
|
|
|
|
|
2014-12-23 15:03:31 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2014-12-23 15:03:31 +08:00
|
|
|
};
|
2015-07-23 17:27:04 +08:00
|
|
|
|
|
|
|
class Issue12249 : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(Issue12249);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-23 17:27:04 +08:00
|
|
|
Issue12249();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-23 17:27:04 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-07-23 17:27:04 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Text* _displayValueLabel;
|
2015-07-23 17:27:04 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class Issue17116 : public UIScene
|
2017-01-10 15:28:47 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(Issue17116);
|
|
|
|
|
|
|
|
Issue17116();
|
|
|
|
|
|
|
|
virtual bool init() override;
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class UIButtonWithPolygonInfo : public UIScene
|
2017-01-20 09:59:30 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(UIButtonWithPolygonInfo);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-20 09:59:30 +08:00
|
|
|
UIButtonWithPolygonInfo();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-20 09:59:30 +08:00
|
|
|
virtual bool init() override;
|
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class UIButtonScale9ChangeSpriteFrame : public UIScene
|
2017-07-17 15:52:01 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(UIButtonScale9ChangeSpriteFrame);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-07-17 15:52:01 +08:00
|
|
|
UIButtonScale9ChangeSpriteFrame();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-07-17 15:52:01 +08:00
|
|
|
virtual bool init() override;
|
|
|
|
};
|
|
|
|
|
2013-09-16 20:54:13 +08:00
|
|
|
#endif /* defined(__TestCpp__UIButtonTest__) */
|