add v1.4 tests

This commit is contained in:
andyque 2014-07-07 18:22:16 +08:00
parent 937b0ab52a
commit 41ccd5e465
4 changed files with 85 additions and 12 deletions

View File

@ -1459,7 +1459,7 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va
}
setPropsForAllCustomWidgetFromJsonDictionary(classname, widget, customJsonDict);
}else{
CCLOG("Widget or WidgetReader doesn't exists!!! Please check your csb file.");
CCLOG("Widget or WidgetReader doesn't exists!!! Please check your json file.");
}
}

View File

@ -25,7 +25,7 @@
#include "CocostudioParserTest.h"
#include "CocoStudioGUITest.h"
#include "CocostudioParserTest/Cocostudio1_4Test.h"
enum
{
@ -40,15 +40,15 @@ static struct
}
g_guisTests[] =
{
// {
// "custom gui image Test",
// [](Ref* sender)
// {
// CustomImageScene* pScene = new CustomImageScene();
// pScene->runThisTest();
// pScene->release();
// }
// },
{
"cocostudio 1.4",
[](Ref* sender)
{
CocostudioV1_4Scene* pScene = new CocostudioV1_4Scene();
pScene->runThisTest();
pScene->release();
}
},
// {
// "custom gui particle widget Test",
// [](Ref* sender)

View File

@ -23,3 +23,61 @@
****************************************************************************/
#include "Cocostudio1_4Test.h"
#include "cocostudio/CCSGUIReader.h"
#include "CocostudioParserTest.h"
USING_NS_CC;
using namespace cocostudio;
// CustomImageLayer
void CocostudioV1_4Layer::onEnter()
{
Layer::onEnter();
GUIReader* guiReader = GUIReader::getInstance();
Layout* layout = static_cast<Layout*>(guiReader->widgetFromJsonFile("cocosui/UIEditorTest/cocostudio1_4/Cocostudio1_4_1.json"));
layout->setScale(0.5);
CCLOG("content size = %f", Director::getInstance()->getContentScaleFactor());
addChild(layout);
}
// CocostudioV1_4Scene
void CocostudioV1_4Scene::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));
Menu* pMenu = Menu::create(pMenuItem, NULL);
pMenu->setPosition( Vec2::ZERO );
pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
addChild(pMenu, 1);
}
void CocostudioV1_4Scene::runThisTest()
{
Layer* pLayer = new CocostudioV1_4Layer();
addChild(pLayer);
pLayer->release();
CCDirector::getInstance()->replaceScene(this);
}
void CocostudioV1_4Scene::BackCallback(Ref* pSender)
{
CocostudioParserTestScene* pScene = new CocostudioParserTestScene();
pScene->runThisTest();
pScene->release();
}

View File

@ -25,6 +25,21 @@
#ifndef __cocos2d_tests__Cocostudio1_4Test__
#define __cocos2d_tests__Cocostudio1_4Test__
#include <iostream>
#include "cocos2d.h"
#include "../../../testBasic.h"
class CocostudioV1_4Layer : public cocos2d::Layer
{
public:
virtual void onEnter();
};
class CocostudioV1_4Scene : public TestScene
{
public:
virtual void onEnter();
virtual void runThisTest();
void BackCallback(cocos2d::Ref* pSender);
};
#endif /* defined(__cocos2d_tests__Cocostudio1_4Test__) */