Merge pull request #6056 from samuele3hu/develop_test

Update some test cases about new Label
This commit is contained in:
James Chen 2014-03-29 11:23:24 +08:00
commit cad5ea2acf
2 changed files with 28 additions and 28 deletions

View File

@ -78,8 +78,8 @@ local function runNotificationCenterTest()
cc.NotificationCenter:getInstance():postNotification(NotificationCenterParam.MSG_SWITCH_STATE,selectedItem)
end
local switchlabel1 = cc.LabelTTF:create("switch off", "Marker Felt", 26)
local switchlabel2 = cc.LabelTTF:create("switch on", "Marker Felt", 26)
local switchlabel1 = cc.Label:create("switch off", "Marker Felt", 26)
local switchlabel2 = cc.Label:create("switch on", "Marker Felt", 26)
local switchitem1 = cc.MenuItemLabel:create(switchlabel1)
local switchitem2 = cc.MenuItemLabel:create(switchlabel2)
local switchitem = cc.MenuItemToggle:create(switchitem1)
@ -144,9 +144,9 @@ local function runNotificationCenterTest()
lightArray[i]:setPosition(cc.p(100, s.height / 4 * i) )
pLayer:addChild(lightArray[i])
local connectlabel1 = cc.LabelTTF:create("not connected", "Marker Felt", 26)
local connectlabel1 = cc.Label:create("not connected", "Marker Felt", 26)
local connectlabel2 = cc.LabelTTF:create("connected", "Marker Felt", 26)
local connectlabel2 = cc.Label:create("connected", "Marker Felt", 26)
local connectitem1 = cc.MenuItemLabel:create(connectlabel1)
local connectitem2 = cc.MenuItemLabel:create(connectlabel2)
local connectitem = cc.MenuItemToggle:create(connectitem1)
@ -348,7 +348,7 @@ local function runCCControlTest()
pLayer:addChild(pRibbon)
--Add the title
pSceneTitleLabel = cc.LabelTTF:create("Title", "Arial", 12)
pSceneTitleLabel = cc.Label:create("Title", "Arial", 12)
pSceneTitleLabel:setPosition(cc.p (VisibleRect:center().x, VisibleRect:top().y - pSceneTitleLabel:getContentSize().height / 2 - 5))
pLayer:addChild(pSceneTitleLabel, 1)
pSceneTitleLabel:setString(pStrTitle)
@ -366,7 +366,7 @@ local function runCCControlTest()
local screenSize = cc.Director:getInstance():getWinSize()
--Add a label in which the slider value will be displayed
local pDisplayValueLabel = cc.LabelTTF:create("Move the slider thumb!\nThe lower slider is restricted." ,"Marker Felt", 32)
local pDisplayValueLabel = cc.Label:create("Move the slider thumb!\nThe lower slider is restricted." ,"Marker Felt", 32)
pDisplayValueLabel:retain()
pDisplayValueLabel:setAnchorPoint(cc.p(0.5, -1.0))
pDisplayValueLabel:setPosition(cc.p(screenSize.width / 1.7, screenSize.height / 2.0))
@ -453,7 +453,7 @@ local function runCCControlTest()
pNode:addChild(pBackground)
dLayer_width = dLayer_width + pBackground:getContentSize().width
pColorLabel = cc.LabelTTF:create("#color", "Marker Felt", 30)
pColorLabel = cc.Label:create("#color", "Marker Felt", 30)
pColorLabel:retain()
pColorLabel:setPosition(pBackground:getPosition())
pNode:addChild(pColorLabel)
@ -487,7 +487,7 @@ local function runCCControlTest()
pNode:addChild(pBackground)
dLayer_width = dLayer_width + pBackground:getContentSize().width
local pDisplayValueLabel = cc.LabelTTF:create("#color" ,"Marker Felt" ,30)
local pDisplayValueLabel = cc.Label:create("#color" ,"Marker Felt" ,30)
pDisplayValueLabel:retain()
pDisplayValueLabel:setPosition(pBackground:getPosition())
@ -532,7 +532,7 @@ local function runCCControlTest()
local pBackgroundButton = cc.Scale9Sprite:create("extensions/button.png")
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
pTitleButton = cc.LabelTTF:create(pStrTitle, "Marker Felt", 30)
pTitleButton = cc.Label:create(pStrTitle, "Marker Felt", 30)
pTitleButton:setColor(cc.c3b(159, 168, 176))
@ -587,7 +587,7 @@ local function runCCControlTest()
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
pBackgroundHighlightedButton:setPreferredSize(cc.size(45, 45))
local pTitleButton = cc.LabelTTF:create(pStrTitle, "Marker Felt", 30)
local pTitleButton = cc.Label:create(pStrTitle, "Marker Felt", 30)
pTitleButton:setColor(cc.c3b(159, 168, 176))
@ -651,7 +651,7 @@ local function runCCControlTest()
--Add a label in which the button events will be displayed
local pDisplayValueLabel = nil
pDisplayValueLabel = cc.LabelTTF:create("No Event", "Marker Felt", 32)
pDisplayValueLabel = cc.Label:create("No Event", "Marker Felt", 32)
pDisplayValueLabel:setAnchorPoint(cc.p(0.5, -1))
pDisplayValueLabel:setPosition(cc.p(screenSize.width / 2.0, screenSize.height / 2.0))
pLayer:addChild(pDisplayValueLabel, 1)
@ -660,7 +660,7 @@ local function runCCControlTest()
local pBackgroundButton = cc.Scale9Sprite:create("extensions/button.png")
local pBackgroundHighlightedButton = cc.Scale9Sprite:create("extensions/buttonHighlighted.png")
local pTitleButtonLabel = cc.LabelTTF:create("Touch Me!", "Marker Felt", 30)
local pTitleButtonLabel = cc.Label:create("Touch Me!", "Marker Felt", 30)
pTitleButtonLabel:setColor(cc.c3b(159, 168, 176))
local pControlButton = cc.ControlButton:create(pTitleButtonLabel, pBackgroundButton)
@ -764,7 +764,7 @@ local function runCCControlTest()
dLayer_width = dLayer_width + pBackground:getContentSize().width
local pDisplayValueLabel = cc.LabelTTF:create("", "HelveticaNeue-Bold", 30)
local pDisplayValueLabel = cc.Label:create("", "HelveticaNeue-Bold", 30)
pDisplayValueLabel:setPosition(pBackground:getPosition())
pNode:addChild(pDisplayValueLabel)
@ -816,7 +816,7 @@ local function runCCControlTest()
background:setPosition(cc.p(layer_width + background:getContentSize().width / 2.0, 0))
pNode:addChild(background)
local pDisplayValueLabel = cc.LabelTTF:create("0", "HelveticaNeue-Bold", 30)
local pDisplayValueLabel = cc.Label:create("0", "HelveticaNeue-Bold", 30)
pDisplayValueLabel:setPosition(background:getPosition())
pNode:addChild(pDisplayValueLabel)
@ -901,7 +901,7 @@ local function runEditBoxTest()
pBg:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2))
newLayer:addChild(pBg)
local TTFShowEditReturn = cc.LabelTTF:create("No edit control return!", "", 30)
local TTFShowEditReturn = cc.Label:create("No edit control return!", "", 30)
TTFShowEditReturn:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50))
newLayer:addChild(TTFShowEditReturn)
@ -1032,7 +1032,7 @@ function TableViewTestLayer.tableCellAtIndex(table, idx)
sprite:setPosition(cc.p(0, 0))
cell:addChild(sprite)
label = cc.LabelTTF:create(strValue, "Helvetica", 20.0)
label = cc.Label:create(strValue, "Helvetica", 20.0)
label:setPosition(cc.p(0,0))
label:setAnchorPoint(cc.p(0,0))
label:setTag(123)

View File

@ -303,7 +303,7 @@ function LabelTTFColor:create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath="fonts/arial.ttf"
ttfConfig.fontSize=35
ttfConfig.fontSize=18
local label1 = cc.Label:createWithTTF(ttfConfig,"Green", cc.VERTICAL_TEXT_ALIGNMENT_CENTER, s.width)
label1:setColor( cc.c3b(0, 255, 0 ))
@ -443,7 +443,7 @@ function LabelFNTandTTFEmpty.create()
-- cc.LabelTTF
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 48
ttfConfig.fontSize = 24
local label2 = cc.Label:createWithTTF(ttfConfig, "", cc.TEXT_ALIGNMENT_CENTER, s.width)
layer:addChild(label2, 0, kTagBitmapAtlas2)
label2:setAnchorPoint(cc.p(0.5, 0.5))
@ -532,7 +532,7 @@ function LabelTTFUnicodeChinese.create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath="fonts/wt021.ttf"
ttfConfig.fontSize=55
ttfConfig.fontSize=28
ttfConfig.glyphs=cc.GLYPHCOLLECTION_CUSTOM
ttfConfig.customGlyphs="美好的一天啊"
@ -809,7 +809,7 @@ function LabelTTFAlignmentNew.create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath="fonts/tahoma.ttf"
ttfConfig.fontSize=32
ttfConfig.fontSize=16
local ttf0 = cc.Label:createWithTTF(ttfConfig, "Alignment 0\nnew line", cc.TEXT_ALIGNMENT_LEFT)
ttf0:setPosition(cc.p(s.width/2,(s.height/6)*2 - 30))
ttf0:setAnchorPoint(cc.p(0.5,0.5))
@ -845,7 +845,7 @@ function LabelTTFUnicodeNew.create()
local ttfConfig = {}
ttfConfig.fontFilePath="fonts/arial.ttf"
ttfConfig.fontSize=45
ttfConfig.fontSize=23
ttfConfig.glyphs=cc.GLYPHCOLLECTION_ASCII
local label1 = cc.Label:createWithTTF(ttfConfig,"Buen día, ¿cómo te llamas?", cc.TEXT_ALIGNMENT_CENTER, s.width)
@ -927,7 +927,7 @@ function LabelTTFLongLineWrapping.create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 28
ttfConfig.fontSize = 14
local label1 = cc.Label:createWithTTF(ttfConfig, LongSentencesExample, cc.TEXT_ALIGNMENT_LEFT, s.width)
label1:setAnchorPoint(cc.p(0.5,1.0))
label1:setPosition(cc.p(s.width/2, s.height/2))
@ -957,7 +957,7 @@ function LabelTTFDynamicAlignment.create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 45
ttfConfig.fontSize = 23
LabelTTFDynamicAlignment._label = cc.Label:createWithTTF(ttfConfig, LongSentencesExample, cc.TEXT_ALIGNMENT_CENTER, s.width)
LabelTTFDynamicAlignment._label:setPosition( cc.p(s.width/2, s.height/2) )
LabelTTFDynamicAlignment._label:setAnchorPoint(cc.p(0.5, 0.5))
@ -1023,7 +1023,7 @@ function LabelTTFCJKWrappingTest.create()
local size = cc.Director:getInstance():getVisibleSize()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/wt021.ttf"
ttfConfig.fontSize = 50
ttfConfig.fontSize = 25
ttfConfig.glyphs = cc.GLYPHCOLLECTION_DYNAMIC
ttfConfig.customGlyphs = nil
ttfConfig.distanceFieldEnabled = true
@ -1090,7 +1090,7 @@ function LabelTTFFontsTestNew.create()
}
local ttfConfig = {}
ttfConfig.fontFilePath = ttfPaths[0]
ttfConfig.fontSize = 40
ttfConfig.fontSize = 20
for i=1, table.getn(ttfPaths) do
ttfConfig.fontFilePath = ttfPaths[i]
local label = cc.Label:createWithTTF( ttfConfig, ttfPaths[i], cc.TEXT_ALIGNMENT_CENTER, 0)
@ -1141,7 +1141,7 @@ function LabelTTFDistanceField.create()
local s = cc.Director:getInstance():getWinSize()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 80
ttfConfig.fontSize = 40
ttfConfig.glyphs = cc.GLYPHCOLLECTION_DYNAMIC
ttfConfig.customGlyphs = nil
ttfConfig.distanceFieldEnabled = true
@ -1182,7 +1182,7 @@ function LabelOutlineAndGlowTest.create()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 80
ttfConfig.fontSize = 40
ttfConfig.glyphs = cc.GLYPHCOLLECTION_DYNAMIC
ttfConfig.customGlyphs = nil
ttfConfig.distanceFieldEnabled = true
@ -1283,7 +1283,7 @@ function LabelCrashTest.create()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 80
ttfConfig.fontSize = 40
ttfConfig.glyphs = cc.GLYPHCOLLECTION_DYNAMIC
ttfConfig.customGlyphs = nil
ttfConfig.distanceFieldEnabled = true