mirror of https://github.com/axmolengine/axmol.git
add Cocostudio 1.3,1.4, 1.5 ui tests
This commit is contained in:
parent
41ccd5e465
commit
8b42eb4ce9
|
@ -807,8 +807,8 @@
|
|||
29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
|
||||
29FBBBF3196A9C7200E65826 /* CocostudioParserTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBF1196A9C7200E65826 /* CocostudioParserTest.cpp */; };
|
||||
29FBBBF4196A9C7200E65826 /* CocostudioParserTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBF1196A9C7200E65826 /* CocostudioParserTest.cpp */; };
|
||||
29FBBBFE196A9ECD00E65826 /* Cocostudio1_4Test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* Cocostudio1_4Test.cpp */; };
|
||||
29FBBBFF196A9ECD00E65826 /* Cocostudio1_4Test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* Cocostudio1_4Test.cpp */; };
|
||||
29FBBBFE196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */; };
|
||||
29FBBBFF196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */; };
|
||||
38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; };
|
||||
38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; };
|
||||
38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; };
|
||||
|
@ -1918,8 +1918,8 @@
|
|||
29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = "<group>"; };
|
||||
29FBBBF1196A9C7200E65826 /* CocostudioParserTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CocostudioParserTest.cpp; path = "/Users/guanghui/cocos2d-x-v3/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.cpp"; sourceTree = "<absolute>"; };
|
||||
29FBBBF2196A9C7200E65826 /* CocostudioParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CocostudioParserTest.h; path = "/Users/guanghui/cocos2d-x-v3/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocostudioParserTest.h"; sourceTree = "<absolute>"; };
|
||||
29FBBBFC196A9ECD00E65826 /* Cocostudio1_4Test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cocostudio1_4Test.cpp; sourceTree = "<group>"; };
|
||||
29FBBBFD196A9ECD00E65826 /* Cocostudio1_4Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cocostudio1_4Test.h; sourceTree = "<group>"; };
|
||||
29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocostudioParserJsonTest.cpp; sourceTree = "<group>"; };
|
||||
29FBBBFD196A9ECD00E65826 /* CocostudioParserJsonTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocostudioParserJsonTest.h; sourceTree = "<group>"; };
|
||||
38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionTimelineTestScene.cpp; sourceTree = "<group>"; };
|
||||
38FA2E72194AEBE100FF2BE4 /* ActionTimelineTestScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionTimelineTestScene.h; sourceTree = "<group>"; };
|
||||
38FA2E75194AECF800FF2BE4 /* ActionTimeline */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ActionTimeline; path = "../tests/cpp-tests/Resources/ActionTimeline"; sourceTree = "<group>"; };
|
||||
|
@ -3882,8 +3882,8 @@
|
|||
children = (
|
||||
29FBBBF1196A9C7200E65826 /* CocostudioParserTest.cpp */,
|
||||
29FBBBF2196A9C7200E65826 /* CocostudioParserTest.h */,
|
||||
29FBBBFC196A9ECD00E65826 /* Cocostudio1_4Test.cpp */,
|
||||
29FBBBFD196A9ECD00E65826 /* Cocostudio1_4Test.h */,
|
||||
29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */,
|
||||
29FBBBFD196A9ECD00E65826 /* CocostudioParserJsonTest.h */,
|
||||
);
|
||||
path = CocostudioParserTest;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4881,7 +4881,7 @@
|
|||
1AC35C5118CECF0C00F37B72 /* testBasic.cpp in Sources */,
|
||||
1AC35B7918CECF0C00F37B72 /* EnemyController.cpp in Sources */,
|
||||
1AC35B6B18CECF0C00F37B72 /* CocosBuilderTest.cpp in Sources */,
|
||||
29FBBBFE196A9ECD00E65826 /* Cocostudio1_4Test.cpp in Sources */,
|
||||
29FBBBFE196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */,
|
||||
1AC35B4118CECF0C00F37B72 /* QuestionContainerSprite.cpp in Sources */,
|
||||
1AC35B6118CECF0C00F37B72 /* DrawPrimitivesTest.cpp in Sources */,
|
||||
1AC35C1718CECF0C00F37B72 /* MotionStreakTest.cpp in Sources */,
|
||||
|
@ -5189,7 +5189,7 @@
|
|||
1AC35B7418CECF0C00F37B72 /* TimelineCallbackTestLayer.cpp in Sources */,
|
||||
29080D9E191B595E0066F8DF /* CustomParticleWidgetReader.cpp in Sources */,
|
||||
1AC35BFC18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */,
|
||||
29FBBBFF196A9ECD00E65826 /* Cocostudio1_4Test.cpp in Sources */,
|
||||
29FBBBFF196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */,
|
||||
1AC35C3618CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */,
|
||||
1AC35C3C18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */,
|
||||
29080DA2191B595E0066F8DF /* GUIEditorTest.cpp in Sources */,
|
||||
|
|
|
@ -54,7 +54,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
if(!glview) {
|
||||
glview = GLView::create("Cpp Tests");
|
||||
glview = GLView::createWithRect("Cpp Tests",Rect(100,100,960,640));
|
||||
director->setOpenGLView(glview);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "CocostudioParserTest.h"
|
||||
|
||||
#include "CocoStudioGUITest.h"
|
||||
#include "CocostudioParserTest/Cocostudio1_4Test.h"
|
||||
#include "CocostudioParserTest/CocostudioParserJsonTest.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -41,23 +41,33 @@ static struct
|
|||
g_guisTests[] =
|
||||
{
|
||||
{
|
||||
"cocostudio 1.4",
|
||||
"cocostudio 1.3",
|
||||
[](Ref* sender)
|
||||
{
|
||||
CocostudioV1_4Scene* pScene = new CocostudioV1_4Scene();
|
||||
CocostudioParserJsonScene* pScene = new CocostudioParserJsonScene("cocosui/UIEditorTest/cocostudio1_3/CocostudioV1_3_1.json");
|
||||
pScene->runThisTest();
|
||||
pScene->release();
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "custom gui particle widget Test",
|
||||
// [](Ref* sender)
|
||||
// {
|
||||
// CustomParticleWidgetScene* pScene = new CustomParticleWidgetScene();
|
||||
// pScene->runThisTest();
|
||||
// pScene->release();
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"cocostudio 1.4",
|
||||
[](Ref* sender)
|
||||
{
|
||||
CocostudioParserJsonScene* pScene = new CocostudioParserJsonScene("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.json");
|
||||
pScene->runThisTest();
|
||||
pScene->release();
|
||||
}
|
||||
},
|
||||
{
|
||||
"cocostudio 1.5",
|
||||
[](Ref* sender)
|
||||
{
|
||||
CocostudioParserJsonScene* pScene = new CocostudioParserJsonScene("cocosui/UIEditorTest/cocostudio1_5/Cocostudio1_5_1.json");
|
||||
pScene->runThisTest();
|
||||
pScene->release();
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static const int g_maxTests = sizeof(g_guisTests) / sizeof(g_guisTests[0]);
|
||||
|
|
|
@ -22,41 +22,47 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "Cocostudio1_4Test.h"
|
||||
#include "CocostudioParserJsonTest.h"
|
||||
#include "cocostudio/CCSGUIReader.h"
|
||||
#include "ui/CocosGUI.h"
|
||||
#include "CocostudioParserTest.h"
|
||||
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocostudio;
|
||||
using namespace cocos2d::ui;
|
||||
|
||||
// CustomImageLayer
|
||||
CocostudioParserJsonLayer::CocostudioParserJsonLayer(std::string jsonFile)
|
||||
{
|
||||
_jsonFile = jsonFile;
|
||||
}
|
||||
|
||||
|
||||
void CocostudioV1_4Layer::onEnter()
|
||||
void CocostudioParserJsonLayer::onEnter()
|
||||
{
|
||||
Layer::onEnter();
|
||||
|
||||
GUIReader* guiReader = GUIReader::getInstance();
|
||||
|
||||
|
||||
Layout* layout = static_cast<Layout*>(guiReader->widgetFromJsonFile("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.json"));
|
||||
Layout* layout = static_cast<Layout*>(guiReader->widgetFromJsonFile(_jsonFile.c_str()));
|
||||
layout->setScale(0.5);
|
||||
CCLOG("content size = %f", Director::getInstance()->getContentScaleFactor());
|
||||
addChild(layout);
|
||||
}
|
||||
|
||||
|
||||
// CocostudioV1_4Scene
|
||||
// CocostudioParserJsonScene
|
||||
CocostudioParserJsonScene::CocostudioParserJsonScene(std::string jsonFile)
|
||||
{
|
||||
_jsonFile = jsonFile;
|
||||
}
|
||||
|
||||
|
||||
void CocostudioV1_4Scene::onEnter()
|
||||
void CocostudioParserJsonScene::onEnter()
|
||||
{
|
||||
CCScene::onEnter();
|
||||
|
||||
auto label = Label::createWithTTF("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocostudioV1_4Scene::BackCallback, this));
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocostudioParserJsonScene::BackCallback, this));
|
||||
|
||||
Menu* pMenu = Menu::create(pMenuItem, NULL);
|
||||
|
||||
|
@ -66,16 +72,16 @@ void CocostudioV1_4Scene::onEnter()
|
|||
addChild(pMenu, 1);
|
||||
}
|
||||
|
||||
void CocostudioV1_4Scene::runThisTest()
|
||||
void CocostudioParserJsonScene::runThisTest()
|
||||
{
|
||||
Layer* pLayer = new CocostudioV1_4Layer();
|
||||
Layer* pLayer = new CocostudioParserJsonLayer(_jsonFile);
|
||||
addChild(pLayer);
|
||||
pLayer->release();
|
||||
|
||||
CCDirector::getInstance()->replaceScene(this);
|
||||
}
|
||||
|
||||
void CocostudioV1_4Scene::BackCallback(Ref* pSender)
|
||||
void CocostudioParserJsonScene::BackCallback(Ref* pSender)
|
||||
{
|
||||
CocostudioParserTestScene* pScene = new CocostudioParserTestScene();
|
||||
pScene->runThisTest();
|
|
@ -22,24 +22,32 @@
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __cocos2d_tests__Cocostudio1_4Test__
|
||||
#define __cocos2d_tests__Cocostudio1_4Test__
|
||||
#ifndef __cocos2d_tests__CocostudioParserJsonTest__
|
||||
#define __cocos2d_tests__CocostudioParserJsonTest__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "../../../testBasic.h"
|
||||
|
||||
class CocostudioV1_4Layer : public cocos2d::Layer
|
||||
class CocostudioParserJsonLayer : public cocos2d::Layer
|
||||
{
|
||||
public:
|
||||
CocostudioParserJsonLayer(std::string jsonFile);
|
||||
~CocostudioParserJsonLayer(){}
|
||||
virtual void onEnter();
|
||||
private:
|
||||
std::string _jsonFile;
|
||||
};
|
||||
|
||||
class CocostudioV1_4Scene : public TestScene
|
||||
class CocostudioParserJsonScene : public TestScene
|
||||
{
|
||||
public:
|
||||
CocostudioParserJsonScene(std::string jsonFile);
|
||||
~CocostudioParserJsonScene(){}
|
||||
virtual void onEnter();
|
||||
virtual void runThisTest();
|
||||
void BackCallback(cocos2d::Ref* pSender);
|
||||
private:
|
||||
std::string _jsonFile;
|
||||
};
|
||||
|
||||
#endif /* defined(__cocos2d_tests__Cocostudio1_4Test__) */
|
||||
#endif /* defined(__cocos2d_tests__CocostudioParserJsonTest__) */
|
Loading…
Reference in New Issue