Skip to content

Commit 7027d83

Browse files
committed
add one new label test
1 parent 6062ec1 commit 7027d83

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test/visual-tests/src/LabelTest/LabelTest.js

+48
Original file line numberDiff line numberDiff line change
@@ -2047,10 +2047,58 @@ var labelTTFDrawModeTest = AtlasDemo.extend({
20472047
}
20482048
});
20492049

2050+
var NewLabelTest = AtlasDemo.extend({
2051+
_testLabel: null,
2052+
_labelAlignCode: 0,
2053+
ctor:function () {
2054+
this._super();
2055+
var testLabel = new cc.Label("Times");
2056+
testLabel.setFontSize(40);
2057+
testLabel.setContentSize(cc.size(480,320));
2058+
testLabel.enableWrapText(false);
2059+
testLabel.setOverflow(cc.Label.Overflow.CLAMP);
2060+
this._testLabel = testLabel;
2061+
testLabel.x = 100;
2062+
testLabel.y = 50;
2063+
var sentence = "a short sentence.\n" +
2064+
"this is the second paragraph it could be long.\n" +
2065+
"中文的长句子中文的长句子中文的长句子中文的长句子中文的长句子长句子.\n" +
2066+
"中文的长句子中文的长句子中文的长句子中文的长句子中文的长句子长句子第四段短句";
2067+
testLabel.setString(sentence);
2068+
this.updateLabelAlign(this._labelAlignCode);
2069+
this.schedule(this.scheduleLabel,2);
2070+
this.addChild(testLabel);
2071+
2072+
//testLabel = new cc.Label();
2073+
//testLabel.x = 200;
2074+
//testLabel.y = 300;
2075+
//testLabel.setString(" Test Label");
2076+
//this.addChild(testLabel);
2077+
},
2078+
scheduleLabel: function(dt) {
2079+
this._labelAlignCode++;
2080+
this.updateLabelAlign(this._labelAlignCode);
2081+
},
2082+
updateLabelAlign: function(value) {
2083+
value = value % 9;
2084+
var valuex = value % 3;
2085+
var valuey = (value / 3) | 0;
2086+
this._testLabel.setVerticalAlign(valuey);
2087+
this._testLabel.setHorizontalAlign(valuex);
2088+
},
2089+
title:function () {
2090+
return "NewLabelTest";
2091+
},
2092+
subtitle:function() {
2093+
return "TTF new label";
2094+
}
2095+
});
2096+
20502097
//
20512098
// Flow control
20522099
//
20532100
var arrayOfLabelTest = [
2101+
NewLabelTest,
20542102
LabelAtlasOpacityTest,
20552103
LabelAtlasOpacityColorTest,
20562104
LabelAtlasHD,

0 commit comments

Comments
 (0)