From 26358c9c2c86390ed114b29d46be6112f34578d9 Mon Sep 17 00:00:00 2001 From: ZhangMenghe Date: Mon, 21 Sep 2015 11:05:21 +0800 Subject: [PATCH] DrawLabel Mode testcase --- tests/js-tests/src/LabelTest/LabelTest.js | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/js-tests/src/LabelTest/LabelTest.js b/tests/js-tests/src/LabelTest/LabelTest.js index d873cdc368..216610e8b6 100644 --- a/tests/js-tests/src/LabelTest/LabelTest.js +++ b/tests/js-tests/src/LabelTest/LabelTest.js @@ -2014,6 +2014,39 @@ var WrapAlgorithmTest = AtlasDemo.extend({ } }); +var labelTTFDrawModeTest = AtlasDemo.extend({ + ctor:function () { + this._super(); + var cacheLabel = new cc.LabelTTF(); + cacheLabel.font = "32px 'Courier New'"; + cacheLabel.string = "This is a labelTTF \ndrawn On cached Canvas!"; + cacheLabel.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER); + this.addChild(cacheLabel); + cacheLabel.x = winSize.width / 2; + cacheLabel.y = 3*winSize.height / 4 - cacheLabel.height; + + + var directLabel = new cc.LabelTTF(); + if(cc._renderType === cc._RENDER_TYPE_CANVAS) { + directLabel.setDrawMode(false); + directLabel.string = "This is a labelTTF \ndrawn On Screen"; + } + else + directLabel.string = "WebGL does NOT support to \ndraw labelTTF on Screen"; + directLabel.font = "32px 'Courier New'"; + directLabel.setHorizontalAlignment(cc.TEXT_ALIGNMENT_CENTER); + this.addChild(directLabel); + directLabel.x = winSize.width / 2; + directLabel.y = winSize.height / 4 ; + }, + title:function () { + return "LabelTTF DrawMode Test"; + }, + subtitle:function() { + return "Compare cacheMode to directMode"; + } +}); + // // Flow control // @@ -2047,7 +2080,8 @@ var arrayOfLabelTest = [ LabelTTFAlignment, LabelsEmpty, - LabelTTFStrokeShadowTest + LabelTTFStrokeShadowTest, + labelTTFDrawModeTest ]; if (!cc.sys.isNative || cc.sys.isMobile) {