From c265a1844b0eb9cec383fad562f3a18d29ee8c53 Mon Sep 17 00:00:00 2001 From: dingpinglv Date: Sun, 9 Jun 2013 10:44:47 +0800 Subject: [PATCH 1/3] fixed #2269 add a condition to LabelTest for LabelTTFStrokeShadowTest --- tests/LabelTest/LabelTest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/LabelTest/LabelTest.js b/tests/LabelTest/LabelTest.js index e3d5ec0a..e581b5ae 100644 --- a/tests/LabelTest/LabelTest.js +++ b/tests/LabelTest/LabelTest.js @@ -1738,11 +1738,15 @@ var arrayOfLabelTest = [ LabelTTFA8Test, LabelTTFFontInitTest, LabelTTFAlignment, - LabelTTFStrokeShadowTest, LabelsEmpty ]; +if( sys.platform != "browser"){ + //Not implement in HTML5 + arrayOfLabelTest.push(LabelTTFStrokeShadowTest); +} + var nextLabelTest = function () { labelTestIdx++; labelTestIdx = labelTestIdx % arrayOfLabelTest.length; From 03ceffd1b11a436b88055c18f8f67f82b47e860a Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Tue, 11 Jun 2013 23:59:13 -0700 Subject: [PATCH 2/3] Adding new tests for testing multiple activities and views. Currently only available on Android --- tests/MultiViewTest/MultiViewTest.js | 138 +++++++++++++++++++++++++++ tests/tests-boot-jsb.js | 4 +- tests/tests-main.js | 14 ++- 3 files changed, 150 insertions(+), 6 deletions(-) create mode 100644 tests/MultiViewTest/MultiViewTest.js diff --git a/tests/MultiViewTest/MultiViewTest.js b/tests/MultiViewTest/MultiViewTest.js new file mode 100644 index 00000000..d52adc12 --- /dev/null +++ b/tests/MultiViewTest/MultiViewTest.js @@ -0,0 +1,138 @@ +/**************************************************************************** + + http://www.cocos2d-html5.org + http://www.cocos2d-iphone.org + http://www.cocos2d-x.org + + + 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: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 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. + ****************************************************************************/ + +var multiViewTestSceneIdx = -1; +//------------------------------------------------------------------ +// +// MultiViewTestBase +// +//------------------------------------------------------------------ +var MultiViewTestBase = BaseTestLayer.extend({ + _title:"", + _subtitle:"", + + ctor:function() { + this._super(cc.c4b(0,0,0,255), cc.c4b(98,99,117,255)); + }, + + onRestartCallback:function (sender) { + var s = new MultiViewTestScene(); + s.addChild(restartMultiViewTest()); + director.replaceScene(s); + }, + onNextCallback:function (sender) { + var s = new MultiViewTestScene(); + s.addChild(nextMultiViewTest()); + director.replaceScene(s); + }, + onBackCallback:function (sender) { + var s = new MultiViewTestScene(); + s.addChild(previousMultiViewTest()); + director.replaceScene(s); + }, + // automation + numberOfPendingTests:function() { + return ( (arrayOfMultiViewTest.length-1) - multiViewTestSceneIdx ); + }, + + getTestNumber:function() { + return multiViewTestSceneIdx; + } + +}); + + +//------------------------------------------------------------------ +// +// CapabilitiesTest +// +//------------------------------------------------------------------ +var KillAndSwitchTest = MultiViewTestBase.extend({ + _title:"Stability test: Kill and Switch Activity/View", + _subtitle:"Coming back into cocos2d-x should start a new instance of TestJavascript", + + handleCloseActivity: function() { + cc.switchAndKillActivity(); + }, + + ctor:function () { + this._super(); + + var clickButton = cc.MenuItemFont.create("Click here to kill this cocos2d-x Activity and switch to new one", this.handleCloseActivity, this); + var menu = cc.Menu.create(clickButton); + menu.alignItemsVertically(); + this.addChild(menu); + } +}); + + +var MultiViewTestScene = TestScene.extend({ + runThisTest:function () { + multiViewTestSceneIdx = -1; + var layer = nextMultiViewTest(); + this.addChild(layer); + + director.replaceScene(this); + } +}); + +// +// Flow control +// + +var arrayOfMultiViewTest = [ +]; + +var arrayOfIOSSpeceficTests = [ +]; + +var arrayOfAndroidSpeceficTests = [ + KillAndSwitchTest +]; + +if(sys.os == "android") { + arrayOfMultiViewTest = arrayOfMultiViewTest.concat(arrayOfAndroidSpeceficTests); +} else if(sys.os == "ios") { + arrayOfMultiViewTest.concat(arrayOfIOSSpeceficTests); +} + +var nextMultiViewTest = function () { + multiViewTestSceneIdx++; + multiViewTestSceneIdx = multiViewTestSceneIdx % arrayOfMultiViewTest.length; + + return new arrayOfMultiViewTest[multiViewTestSceneIdx](); +}; +var previousMultiViewTest = function () { + multiViewTestSceneIdx--; + if (multiViewTestSceneIdx < 0) + multiViewTestSceneIdx += arrayOfMultiViewTest.length; + + return new arrayOfMultiViewTest[multiViewTestSceneIdx](); +}; +var restartMultiViewTest = function () { + return new arrayOfMultiViewTest[multiViewTestSceneIdx](); +}; + diff --git a/tests/tests-boot-jsb.js b/tests/tests-boot-jsb.js index ee5e7894..398b42b0 100644 --- a/tests/tests-boot-jsb.js +++ b/tests/tests-boot-jsb.js @@ -13,7 +13,6 @@ var tests_files = [ // base class 'BaseTestLayer/BaseTestLayer.js', - 'ActionManagerTest/ActionManagerTest.js', 'ActionsTest/ActionsTest.js', 'ChipmunkTest/ChipmunkTest.js', @@ -55,7 +54,8 @@ var tests_files = [ 'TileMapTest/TileMapTest.js', 'TransitionsTest/TransitionsTest.js', 'UnitTest/UnitTest.js', - 'SysTest/SysTest.js' + 'SysTest/SysTest.js', + 'MultiViewTest/MultiViewTest.js' ]; for (var i = 0; i < tests_files.length; i++) { diff --git a/tests/tests-main.js b/tests/tests-main.js index dd8050d5..702c47b9 100644 --- a/tests/tests-main.js +++ b/tests/tests-main.js @@ -240,7 +240,7 @@ var testNames = [ }, { title:"ClippingNode Test", - platforms: PLATFORM_JSB_AND_WEBGL, + platforms: PLATFORM_HTML5_WEBGL, testScene:function () { return new ClippingNodeTestScene(); } @@ -285,7 +285,7 @@ var testNames = [ { title:"Extensions Test", resource:g_extensions, - platforms: PLATFORM_HTML5, + platforms: PLATFORM_ALL, testScene:function () { return new ExtensionsTestScene(); } @@ -359,6 +359,13 @@ var testNames = [ return new MotionStreakTestScene(); } }, + { + title:"MultiView Tests", + platforms: PLATFORM_ALL, + testScene:function () { + return new MultiViewTestScene(); + } + }, { title:"Node Test", platforms: PLATFORM_ALL, @@ -366,9 +373,9 @@ var testNames = [ return new NodeTestScene(); } }, + //"MotionStreakTest", { title:"OpenGL Test", - resource:g_opengl_resources, platforms: PLATFORM_JSB_AND_WEBGL, testScene:function () { return new OpenGLTestScene(); @@ -393,7 +400,6 @@ var testNames = [ { title:"Performance Test", platforms: PLATFORM_ALL, - resource:g_performace, testScene:function () { return new PerformanceTestScene(); } From b48980540b66d69f0bb84f752338cde1ab9a845f Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 12 Jun 2013 00:01:34 -0700 Subject: [PATCH 3/3] Making MultiView tests only available when on Android --- tests/tests-main.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/tests-main.js b/tests/tests-main.js index 702c47b9..aeba71bb 100644 --- a/tests/tests-main.js +++ b/tests/tests-main.js @@ -359,13 +359,6 @@ var testNames = [ return new MotionStreakTestScene(); } }, - { - title:"MultiView Tests", - platforms: PLATFORM_ALL, - testScene:function () { - return new MultiViewTestScene(); - } - }, { title:"Node Test", platforms: PLATFORM_ALL, @@ -520,6 +513,21 @@ var testNames = [ //"ZwoptexTest", ]; +var androidTestNames = [ + { + title:"MultiView Tests", + platforms: PLATFORM_ALL, + testScene:function () { + return new MultiViewTestScene(); + } + } +] + +if(sys.os == "android") { + testNames = testNames.concat(androidTestNames); +} + + var s_rcVisible = cc.rect(0, 0, 0, 0); var s_ptCenter = cc.p(0, 0); var s_ptTop = cc.p(0, 0);