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
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
http://www.cocos2d-x.org
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +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
|
|
|
|
2018-01-29 16:25:32 +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
|
|
|
|
2018-01-29 16:25:32 +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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-08-31 17:03:58 +08:00
|
|
|
#ifndef _LAYER_TEST_H_
|
|
|
|
#define _LAYER_TEST_H_
|
|
|
|
|
2013-06-07 08:12:28 +08:00
|
|
|
#include "../BaseTest.h"
|
2017-05-22 13:42:00 +08:00
|
|
|
#include "cocos/ui/UISlider.h"
|
|
|
|
#include "../cocos/ui/UIListView.h"
|
2010-08-31 17:03:58 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
DEFINE_TEST_SUITE(LayerTests);
|
|
|
|
|
|
|
|
class LayerTest : public TestCase
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2015-04-22 10:20:21 +08:00
|
|
|
public:
|
|
|
|
virtual std::string title() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
protected:
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string _title;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2013-02-28 16:03:55 +08:00
|
|
|
class LayerTestCascadingOpacityA : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingOpacityA);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestCascadingOpacityB : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingOpacityB);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestCascadingOpacityC : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingOpacityC);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestCascadingColorA : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingColorA);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestCascadingColorB : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingColorB);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestCascadingColorC : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestCascadingColorC);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2013-02-28 16:03:55 +08:00
|
|
|
};
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
class LayerTest1 : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTest1);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void updateSize(cocos2d::Vec2& touchLocation);
|
2010-08-31 17:03:58 +08:00
|
|
|
|
2015-04-09 08:37:30 +08:00
|
|
|
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
|
|
|
|
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
|
|
|
|
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTest2 : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTest2);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerTestBlend : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerTestBlend);
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
LayerTestBlend();
|
2012-06-08 13:55:28 +08:00
|
|
|
void newBlend(float dt);
|
2014-02-28 23:02:22 +08:00
|
|
|
virtual std::string subtitle() const override;
|
2010-08-31 17:03:58 +08:00
|
|
|
};
|
|
|
|
|
2013-06-20 13:43:40 +08:00
|
|
|
class LayerGradientTest : public LayerTest
|
2011-02-23 16:47:25 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerGradientTest);
|
2013-06-20 13:43:40 +08:00
|
|
|
LayerGradientTest();
|
2015-04-09 08:37:30 +08:00
|
|
|
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
void toggleItem(cocos2d::Ref* sender);
|
2011-02-23 16:47:25 +08:00
|
|
|
};
|
|
|
|
|
2013-06-29 10:02:10 +08:00
|
|
|
class LayerGradientTest2 : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerGradientTest2);
|
2013-06-29 10:02:10 +08:00
|
|
|
LayerGradientTest2();
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-06-29 10:02:10 +08:00
|
|
|
};
|
|
|
|
|
2012-06-12 15:14:01 +08:00
|
|
|
class LayerIgnoreAnchorPointPos : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerIgnoreAnchorPointPos);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2015-04-09 08:37:30 +08:00
|
|
|
void onToggle(cocos2d::Ref* pObject);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 15:14:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerIgnoreAnchorPointRot : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerIgnoreAnchorPointRot);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2015-04-09 08:37:30 +08:00
|
|
|
void onToggle(cocos2d::Ref* pObject);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 15:14:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerIgnoreAnchorPointScale : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerIgnoreAnchorPointScale);
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2015-04-09 08:37:30 +08:00
|
|
|
void onToggle(cocos2d::Ref* pObject);
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 15:14:01 +08:00
|
|
|
};
|
|
|
|
|
2012-11-20 18:00:27 +08:00
|
|
|
class LayerExtendedBlendOpacityTest : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 09:36:33 +08:00
|
|
|
CREATE_FUNC(LayerExtendedBlendOpacityTest);
|
2012-11-20 18:00:27 +08:00
|
|
|
LayerExtendedBlendOpacityTest();
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-11-20 18:00:27 +08:00
|
|
|
};
|
|
|
|
|
2013-12-11 15:57:20 +08:00
|
|
|
class LayerBug3162A : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(LayerBug3162A);
|
2013-12-20 04:23:42 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-11 15:57:20 +08:00
|
|
|
void step(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-11 15:57:20 +08:00
|
|
|
private:
|
2015-04-09 08:37:30 +08:00
|
|
|
cocos2d::LayerColor* _layer[3];
|
2013-12-11 15:57:20 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class LayerBug3162B : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(LayerBug3162B);
|
2013-12-20 04:23:42 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-11 15:57:20 +08:00
|
|
|
void step(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2013-12-11 15:57:20 +08:00
|
|
|
private:
|
2015-04-09 08:37:30 +08:00
|
|
|
cocos2d::LayerColor* _layer[3];
|
2013-12-11 15:57:20 +08:00
|
|
|
};
|
|
|
|
|
2014-01-09 14:50:29 +08:00
|
|
|
class LayerColorOccludeBug : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(LayerColorOccludeBug);
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-01-09 14:50:29 +08:00
|
|
|
private:
|
2015-04-09 08:37:30 +08:00
|
|
|
cocos2d::LayerColor* _layer;
|
2014-01-09 14:50:29 +08:00
|
|
|
};
|
|
|
|
|
2017-05-22 13:42:00 +08:00
|
|
|
class LayerRadialGradientTest : public LayerTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(LayerRadialGradientTest);
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual std::string title() const override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-05-22 13:42:00 +08:00
|
|
|
void sliderCallback(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type);
|
|
|
|
void listviewCallback(cocos2d::Ref* sender, cocos2d::ui::ListView::EventType type);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-05-22 13:42:00 +08:00
|
|
|
private:
|
|
|
|
cocos2d::ui::Slider* createSlider();
|
|
|
|
cocos2d::ui::ListView* createListView();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-05-22 13:42:00 +08:00
|
|
|
cocos2d::LayerRadialGradient* _layer;
|
|
|
|
int _currentSeletedItemIndex;
|
|
|
|
};
|
|
|
|
|
2010-08-31 17:03:58 +08:00
|
|
|
#endif
|