2013-12-23 15:35:35 +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.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-23 15:35:35 +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:
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-23 15:35:35 +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__UILayoutTest__
|
|
|
|
#define __TestCpp__UILayoutTest__
|
|
|
|
|
|
|
|
#include "../UIScene.h"
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
DEFINE_TEST_SUITE(UILayoutTests);
|
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
class UILayoutTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest();
|
|
|
|
~UILayoutTest();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Color : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Color();
|
|
|
|
~UILayoutTest_Color();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Color);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Gradient : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Gradient();
|
|
|
|
~UILayoutTest_Gradient();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Gradient);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_BackGroundImage : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_BackGroundImage();
|
|
|
|
~UILayoutTest_BackGroundImage();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_BackGroundImage);
|
2015-11-30 16:17:13 +08:00
|
|
|
|
2022-10-18 19:17:36 +08:00
|
|
|
void printWidgetResources(ax::Ref* sender);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-11-30 16:17:13 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::ui::Layout* _layout;
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_BackGroundImage_Scale9 : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_BackGroundImage_Scale9();
|
|
|
|
~UILayoutTest_BackGroundImage_Scale9();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_BackGroundImage_Scale9);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Layout_Linear_Vertical : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Linear_Vertical();
|
|
|
|
~UILayoutTest_Layout_Linear_Vertical();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Linear_Vertical);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Layout_Linear_Horizontal : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Linear_Horizontal();
|
|
|
|
~UILayoutTest_Layout_Linear_Horizontal();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Linear_Horizontal);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
2022-11-01 19:02:04 +08:00
|
|
|
class UILayoutTest_Layout_Linear_CenterVertical : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Linear_CenterVertical();
|
|
|
|
~UILayoutTest_Layout_Linear_CenterVertical();
|
|
|
|
virtual bool init() override;
|
|
|
|
|
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Linear_CenterVertical);
|
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Layout_Linear_CenterHorizontal : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Linear_CenterHorizontal();
|
|
|
|
~UILayoutTest_Layout_Linear_CenterHorizontal();
|
|
|
|
virtual bool init() override;
|
|
|
|
|
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Linear_CenterHorizontal);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
class UILayoutTest_Layout_Relative_Align_Parent : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Relative_Align_Parent();
|
|
|
|
~UILayoutTest_Layout_Relative_Align_Parent();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Relative_Align_Parent);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutTest_Layout_Relative_Location : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Relative_Location();
|
|
|
|
~UILayoutTest_Layout_Relative_Location();
|
2015-04-03 14:31:03 +08:00
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Relative_Location);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
2017-05-26 10:09:57 +08:00
|
|
|
class UILayoutTest_Layout_Scaled_Widget : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UILayoutTest_Layout_Scaled_Widget();
|
|
|
|
~UILayoutTest_Layout_Scaled_Widget();
|
|
|
|
virtual bool init() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-05-26 10:09:57 +08:00
|
|
|
CREATE_FUNC(UILayoutTest_Layout_Scaled_Widget);
|
|
|
|
};
|
|
|
|
|
2014-12-22 14:51:50 +08:00
|
|
|
class UILayoutComponentTest : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutComponentTest);
|
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual bool init() override;
|
2022-10-18 19:17:36 +08:00
|
|
|
void touchEvent(ax::Ref* sender, ax::ui::Widget::TouchEventType type);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-12-22 14:51:50 +08:00
|
|
|
protected:
|
2022-10-18 19:17:36 +08:00
|
|
|
ax::LayerColor* _baseLayer;
|
2014-12-22 14:51:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutComponent_Berth_Test : public UILayoutComponentTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool init() override;
|
2015-04-03 14:31:03 +08:00
|
|
|
|
|
|
|
CREATE_FUNC(UILayoutComponent_Berth_Test);
|
2014-12-22 14:51:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class UILayoutComponent_Berth_Stretch_Test : public UILayoutComponentTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool init() override;
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
CREATE_FUNC(UILayoutComponent_Berth_Stretch_Test);
|
2013-12-23 15:35:35 +08:00
|
|
|
};
|
|
|
|
|
2019-12-11 09:40:27 +08:00
|
|
|
class UILayoutTest_Issue19890 : public UIScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool init() override;
|
|
|
|
|
|
|
|
CREATE_FUNC(UILayoutTest_Issue19890);
|
|
|
|
};
|
|
|
|
|
2020-01-06 09:35:39 +08:00
|
|
|
class UILayout_Clipping_Test : public UILayoutComponentTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool init() override;
|
|
|
|
|
|
|
|
CREATE_FUNC(UILayout_Clipping_Test);
|
|
|
|
};
|
|
|
|
|
2013-12-23 15:35:35 +08:00
|
|
|
#endif /* defined(__TestCpp__UILayoutTest__) */
|