From 89798d949bee466d4397b959c040b80012732afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B5=D1=81=D1=88=D0=B0=D0=BF=D0=BE=D1=88=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Tue, 10 Nov 2015 15:13:05 +0300 Subject: [PATCH] [js-tests] Test case for Scale9Sprite fade actions with cascade opacity enabled Test case for https://github.com/cocos2d/cocos2d-html5/pull/3181 --- .../S9SpriteTest/S9SpriteTest.js | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js index 942ff676d1..4b5669184f 100644 --- a/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js +++ b/tests/js-tests/src/ExtensionsTest/S9SpriteTest/S9SpriteTest.js @@ -570,6 +570,36 @@ var S9SpriteColorOpacityTest = S9SpriteTestDemo.extend({ } }); +var S9SpriteOpacityWithFadeActionsTest = S9SpriteTestDemo.extend({ + _title:"Test opacity cascade for Scale9Sprite with fade actions\n(fade to opacity 144, then fadeOut, then fadeIn)", + + ctor:function() { + this._super(); + + var colorLayer = new cc.LayerColor(cc.color(144,144,144)); + colorLayer.setContentSize(winSize.width / 2, winSize.height / 2); + colorLayer.x = winSize.width / 4; + colorLayer.y = winSize.height / 4; + + colorLayer.setCascadeOpacityEnabled(true); + + var blocks = new ccui.Scale9Sprite('blocks9.png'); + blocks.x = winSize.width / 4; + blocks.y = winSize.height / 4; + + colorLayer.addChild(blocks); + + var fadeToAction = cc.fadeTo(1, 144); + var delay = cc.delayTime(0.5); + var fadeOutAction = cc.fadeOut(0.8); + var fadeInAction = cc.fadeIn(0.8); + + colorLayer.runAction(cc.sequence(fadeToAction, delay, fadeOutAction, delay.clone(), fadeInAction)); + + this.addChild(colorLayer); + } +}); + var S9SpriteTestScene = TestScene.extend({ runThisTest:function (num) { sceneIdx = (num || num == 0) ? (num - 1) : -1; @@ -598,7 +628,8 @@ var arrayOfS9SpriteTest = [ S9FrameNameSpriteSheetRotatedInsetsScaled, S9_TexturePacker, S9SpriteActionTest, - S9SpriteColorOpacityTest + S9SpriteColorOpacityTest, + S9SpriteOpacityWithFadeActionsTest ]; var nextS9SpriteTest = function () {