Merge pull request #11545 from samuele3hu/v3_beta0_test

Fix the cocos3.6beta0 bugs
This commit is contained in:
minggo 2015-04-22 14:38:54 +08:00
commit ca1a95f2bb
11 changed files with 56 additions and 25 deletions

View File

@ -166,6 +166,10 @@ bool AppDelegate::applicationDidFinishLaunching()
fileUtils->setSearchPaths(searchPaths); fileUtils->setSearchPaths(searchPaths);
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL);
// Enable Remote Console
auto console = director->getConsole();
console->listenOnTCP(5678);
_testController = TestController::getInstance(); _testController = TestController::getInstance();

View File

@ -574,7 +574,7 @@ void TestColliderDetector::onEnter()
armature2->setScaleX(-0.2f); armature2->setScaleX(-0.2f);
armature2->setScaleY(0.2f); armature2->setScaleY(0.2f);
armature2->setPosition(VisibleRect::right().x - 60, VisibleRect::left().y); armature2->setPosition(VisibleRect::right().x - 60, VisibleRect::left().y);
addChild(armature2); addChild(armature2,1);
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
bullet = cocos2d::extension::PhysicsSprite::createWithSpriteFrameName("25.png"); bullet = cocos2d::extension::PhysicsSprite::createWithSpriteFrameName("25.png");
@ -582,7 +582,7 @@ void TestColliderDetector::onEnter()
bullet = Sprite::createWithSpriteFrameName("25.png"); bullet = Sprite::createWithSpriteFrameName("25.png");
drawNode = DrawNode::create(); drawNode = DrawNode::create();
addChild(drawNode, -1); addChild(drawNode);
#endif #endif
addChild(bullet); addChild(bullet);
@ -1227,6 +1227,10 @@ std::string TestPlaySeveralMovement::subtitle()const
void TestEasing::onEnter() void TestEasing::onEnter()
{ {
ArmatureBaseTest::onEnter(); ArmatureBaseTest::onEnter();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesEnded = CC_CALLBACK_2(TestEasing::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
animationID = 0; animationID = 0;
armature = Armature::create("testEasing"); armature = Armature::create("testEasing");
@ -1237,6 +1241,7 @@ void TestEasing::onEnter()
addChild(armature); addChild(armature);
updateSubTitle(); updateSubTitle();
} }
std::string TestEasing::title() const std::string TestEasing::title() const
@ -1264,6 +1269,10 @@ void TestEasing::updateSubTitle()
void TestChangeAnimationInternal::onEnter() void TestChangeAnimationInternal::onEnter()
{ {
ArmatureBaseTest::onEnter(); ArmatureBaseTest::onEnter();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesEnded = CC_CALLBACK_2(TestChangeAnimationInternal::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
Armature *armature = nullptr; Armature *armature = nullptr;
armature = Armature::create("Cowboy"); armature = Armature::create("Cowboy");

View File

@ -17,7 +17,7 @@ bool CocoStudioComponentsTest::init()
{ {
if (TestCase::init()) if (TestCase::init())
{ {
auto bg = LayerColor::create(Color4B(255, 255, 255, 255)); auto bg = LayerColor::create(Color4B(0, 128, 255, 255));
addChild(bg); addChild(bg);
auto root = createGameScene(); auto root = createGameScene();

View File

@ -57,7 +57,7 @@ GameOverScene::~GameOverScene()
bool GameOverLayer::init() bool GameOverLayer::init()
{ {
if ( LayerColor::initWithColor( Color4B(255,255,255,255) ) ) if ( LayerColor::initWithColor( Color4B(0,128,255,255) ) )
{ {
auto winSize = Director::getInstance()->getWinSize(); auto winSize = Director::getInstance()->getWinSize();
this->_label = Label::createWithTTF("","fonts/arial.ttf", 32); this->_label = Label::createWithTTF("","fonts/arial.ttf", 32);

View File

@ -25,14 +25,6 @@ static std::string fontList[] =
"fonts/Scissor Cuts.ttf", "fonts/Scissor Cuts.ttf",
}; };
FontTests::FontTests()
{
for (auto& fontFile : fontList)
{
addTestCase("FontTests", [&](){return FontTest::create(fontFile); });
}
}
static int vAlignIdx = 0; static int vAlignIdx = 0;
static TextVAlignment verticalAlignment[] = static TextVAlignment verticalAlignment[] =
{ {
@ -41,6 +33,25 @@ static TextVAlignment verticalAlignment[] =
TextVAlignment::BOTTOM, TextVAlignment::BOTTOM,
}; };
FontTests::FontTests()
{
for (auto& fontFile : fontList)
{
addTestCase("FontTests", [&](){vAlignIdx = 0; return FontTest::create(fontFile); });
}
for (auto& fontFile : fontList)
{
addTestCase("FontTests", [&](){ vAlignIdx = 1; return FontTest::create(fontFile); });
}
for (auto& fontFile : fontList)
{
addTestCase("FontTests", [&](){vAlignIdx = 2; return FontTest::create(fontFile); });
}
}
void FontTest::showFont(const std::string& fontFile) void FontTest::showFont(const std::string& fontFile)
{ {
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();

View File

@ -44,6 +44,11 @@ static void setEnableRecursiveCascading(Node* node, bool enable)
} }
} }
std::string LayerTest::title() const
{
return "Layer Test";
}
// LayerTestCascadingOpacityA // LayerTestCascadingOpacityA
void LayerTestCascadingOpacityA::onEnter() void LayerTestCascadingOpacityA::onEnter()
{ {

View File

@ -7,6 +7,8 @@ DEFINE_TEST_SUITE(LayerTests);
class LayerTest : public TestCase class LayerTest : public TestCase
{ {
public:
virtual std::string title() const override;
protected: protected:
std::string _title; std::string _title;
}; };

View File

@ -211,14 +211,6 @@ void TextFieldTTFActionTest::onEnter()
// add TextFieldTTF // add TextFieldTTF
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
std::string strSubtitle = subtitle();
TTFConfig ttfConfig;
ttfConfig.fontFilePath = FONT_NAME;
ttfConfig.fontSize = 16;
auto subTitle = Label::createWithTTF(ttfConfig, strSubtitle.c_str());
addChild(subTitle, 9999);
subTitle->setPosition(VisibleRect::center().x, VisibleRect::top().y - 60);
_textField = TextFieldTTF::textFieldWithPlaceHolder("<click here for input>", _textField = TextFieldTTF::textFieldWithPlaceHolder("<click here for input>",
FONT_NAME, FONT_NAME,
FONT_SIZE); FONT_SIZE);

View File

@ -9,8 +9,8 @@ UIScrollViewEditorTests::UIScrollViewEditorTests()
ADD_TEST_CASE(UIScrollViewTest_Vertical_Editor); ADD_TEST_CASE(UIScrollViewTest_Vertical_Editor);
ADD_TEST_CASE(UIScrollViewTest_Horizontal_Editor); ADD_TEST_CASE(UIScrollViewTest_Horizontal_Editor);
ADD_TEST_CASE(UIScrollViewTest_Both_Editor); ADD_TEST_CASE(UIScrollViewTest_Both_Editor);
ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor); // ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor);
ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor); // ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor);
} }
// UIScrollViewTest_Vertical_Editor // UIScrollViewTest_Vertical_Editor

View File

@ -406,7 +406,15 @@ end
--BugTest1174 --BugTest1174
local function BugTest1174() local function BugTest1174()
local pLayer = cc.Layer:create() local layer = cc.Layer:create()
local size = cc.Director:getInstance():getWinSize()
local subtitleLabel = cc.Label:createWithTTF("The results output on the console", s_thonburiPath, 24)
subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
layer:addChild(subtitleLabel, 1)
subtitleLabel:setPosition(size.width / 2, size.height - 80)
local function check_for_error(p1,p2,p3,p4,s,t) local function check_for_error(p1,p2,p3,p4,s,t)
local p4_p3 = cc.pSub(p4,p3) local p4_p3 = cc.pSub(p4,p3)
@ -549,7 +557,7 @@ local function BugTest1174()
strLog = "Test3 - End. OK="..ok..", Err="..err strLog = "Test3 - End. OK="..ok..", Err="..err
print(strLog) print(strLog)
return pLayer return layer
end end
--BugTestValueTypeJudgeInTable --BugTestValueTypeJudgeInTable

View File

@ -22,7 +22,7 @@ local function CocosDenshionTest()
"pause background music", "pause background music",
"resume background music", "resume background music",
"rewind background music", "rewind background music",
"is background music playing", "is background music playing(output on the console)",
"play effect", "play effect",
"play effect repeatly", "play effect repeatly",
"stop effect", "stop effect",