From 08ec8cc8bfe29403d52dfc01c0dc24857ea81cf9 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 9 Jan 2015 15:23:54 +0800 Subject: [PATCH 1/2] Fix some lua-tests bugs --- tests/lua-tests/src/BillBoardTest/BillBoardTest.lua | 6 +++--- .../CocoStudioActionTimelineTest.lua | 4 ++-- tests/lua-tests/src/PhysicsTest/PhysicsTest.lua | 2 +- tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua | 7 ++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua b/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua index cc175b9797..fe76a35f75 100644 --- a/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua +++ b/tests/lua-tests/src/BillBoardTest/BillBoardTest.lua @@ -77,9 +77,9 @@ function BillBoardTest:init() cameraDir = cc.vec3normalize(cameraDir) cameraDir.y = 0 transformMat = self._camera:getNodeToWorldTransform() - cameraRightDir.x = -transformMat[1] - cameraRightDir.y = -transformMat[2] - cameraRightDir.z = -transformMat[3] + cameraRightDir.x = transformMat[1] + cameraRightDir.y = transformMat[2] + cameraRightDir.z = transformMat[3] cameraRightDir = cc.vec3normalize(cameraRightDir) cameraRightDir.y=0 diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua index a789e939fd..2729bcfda6 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua @@ -243,9 +243,9 @@ function TestChangePlaySection:onEnter() local function onTouchesEnded(touches, event) if action:getStartFrame() == 0 then - action:gotoFrameAndPlay(70, action:getDuration(), true) + action:gotoFrameAndPlay(41, 81, true) else - action:gotoFrameAndPlay(0, 60, true) + action:gotoFrameAndPlay(0, 40, true) end end diff --git a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua index 8a8e496944..59d00d315f 100644 --- a/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua +++ b/tests/lua-tests/src/PhysicsTest/PhysicsTest.lua @@ -1246,7 +1246,7 @@ local function PhysicsPositionRotationTest() local leftBall = cc.Sprite:create("Images/ball.png"); leftBall:setPosition(-30, 0); leftBall:setScale(2); - leftBall:setPhysicsBody(cc.PhysicsBody:createCircle(leftBall:getContentSize().width/4)); + leftBall:setPhysicsBody(cc.PhysicsBody:createCircle(leftBall:getContentSize().width)); leftBall:getPhysicsBody():setTag(DRAG_BODYS_TAG); parent:addChild(leftBall); diff --git a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua index 0ac74b5da6..c45c609c82 100644 --- a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua +++ b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua @@ -1,5 +1,6 @@ local visibleRect = cc.Director:getInstance():getOpenGLView():getVisibleRect() local centerPos = cc.p(visibleRect.x + visibleRect.width / 2,visibleRect.y + visibleRect.height /2) +local targetPlatform = cc.Application:getInstance():getTargetPlatform() local function VideoPlayerTest() local layer = cc.Layer:create() --createTestLayer("VideoPlayerTest", "") @@ -93,7 +94,11 @@ local function VideoPlayerTest() ------------------------------------------------------------ local function menuResourceVideoCallback(tag, sender) if nil ~= videoPlayer then - videoPlayer:setFileName("res/cocosvideo.mp4") + if cc.PLATFORM_OS_IPHONE == targetPlatform then + videoPlayer:setFileName("cocosvideo.mp4") + else + videoPlayer:setFileName("res/cocosvideo.mp4") + end videoPlayer:play() end end From 6a55fef70e7396cdb59c89223bf9357e5d1a505b Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 9 Jan 2015 16:45:51 +0800 Subject: [PATCH 2/2] Update the VideoPlayerTest to passing the fullpath of video resource --- tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua index c45c609c82..8122f3c651 100644 --- a/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua +++ b/tests/lua-tests/src/VideoPlayerTest/VideoPlayerTest.lua @@ -1,6 +1,5 @@ local visibleRect = cc.Director:getInstance():getOpenGLView():getVisibleRect() local centerPos = cc.p(visibleRect.x + visibleRect.width / 2,visibleRect.y + visibleRect.height /2) -local targetPlatform = cc.Application:getInstance():getTargetPlatform() local function VideoPlayerTest() local layer = cc.Layer:create() --createTestLayer("VideoPlayerTest", "") @@ -94,11 +93,8 @@ local function VideoPlayerTest() ------------------------------------------------------------ local function menuResourceVideoCallback(tag, sender) if nil ~= videoPlayer then - if cc.PLATFORM_OS_IPHONE == targetPlatform then - videoPlayer:setFileName("cocosvideo.mp4") - else - videoPlayer:setFileName("res/cocosvideo.mp4") - end + local videoFullPath = cc.FileUtils:getInstance():fullPathForFilename("cocosvideo.mp4") + videoPlayer:setFileName(videoFullPath) videoPlayer:play() end end