Merge pull request #1214 from John-cdy/gles20

issue #1404: Add android test python script files and modify android com...
This commit is contained in:
minggo 2012-08-22 00:26:41 -07:00
commit c7d20e2fef
9 changed files with 1134 additions and 35 deletions

View File

@ -48,8 +48,14 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:8).
call ant debug
set result8=%ERROELEVEL%
set result8=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10
if %result8% NEQ 0 goto API_10
cd bin
ren Tests-debug.apk Tests-debug-8.apk
cd ..
:API_10
::Change API level.(API level:10)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-8" (echo/target=android-10)else echo/%%a
@ -59,7 +65,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:10).
call ant debug
set result10=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11
if %result10% NEQ 0 goto API_11
cd bin
ren Tests-debug.apk Tests-debug-10.apk
cd ..
:API_11
::Change API level.(API level:11)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-10" (echo/target=android-11)else echo/%%a
@ -69,7 +81,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:11).
call ant debug
set result11=%ERRORlEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12
if %result11% NEQ 0 goto API_12
cd bin
ren Tests-debug.apk Tests-debug-11.apk
cd ..
:API_12
::Change API level.(API level:12)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-11" (echo/target=android-12)else echo/%%a
@ -79,7 +97,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:12).
call ant debug
set result12=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13
if %result12% NEQ 0 goto API_13
cd bin
ren Tests-debug.apk Tests-debug-12.apk
cd ..
:API_13
::Change API level.(API level:13)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-12" (echo/target=android-13)else echo/%%a
@ -89,7 +113,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:13).
call ant debug
set result13=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result13% NEQ 0 goto NEXTPROJ
cd bin
ren Tests-debug.apk Tests-debug-13.apk
cd ..
:NEXTPROJ
::After all test versions completed,changed current API level to the original.(API level:8)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-13" (echo/target=android-8)else echo/%%a
@ -98,28 +128,24 @@ move anttmp.properties ant.properties
::Calculate the errorlevel and change build target.
cd ..\..\..
IF "%_PROJECTNAME%"=="TestCpp" set /a testresult1=(result8+result10+result11+result12+result13) && set _PROJECTNAME=HelloCpp&& goto project
IF "%_PROJECTNAME%"=="HelloCpp" set /a testresult2=(result8+result10+result11+result12+result13) && set _PROJECTNAME=HelloLua&& goto project
IF "%_PROJECTNAME%"=="HelloLua" set /a testresult3=(result8+result10+result11+result12+result13)
if "%_PROJECTNAME%"=="TestCpp" set /a testresult1=(result8+result10+result11+result12+result13) && set _PROJECTNAME=HelloCpp&& goto project
if "%_PROJECTNAME%"=="HelloCpp" set /a testresult2=(result8+result10+result11+result12+result13) && set _PROJECTNAME=HelloLua&& goto project
if "%_PROJECTNAME%"=="HelloLua" set /a testresult3=(result8+result10+result11+result12+result13)
set /a testresult=(testresult1+testresult2+testresult3)
IF %testresult% NEQ 0 goto error
if %testresult% NEQ 0 goto error
goto success
:error
echo Error.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 1
goto end
:success
echo Success.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 0
goto end
::End.

View File

@ -54,7 +54,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:14).
call ant debug
set result14=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15
if %result14% NEQ 0 goto API_15
cd bin
ren Tests-debug.apk Tests-debug-14.apk
cd ..
:API_15
::Change API level.(API level:15)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-14" (echo/target=android-15)else echo/%%a
@ -64,7 +70,13 @@ move anttmp.properties ant.properties
::Android ant build(debug,API level:15).
call ant debug
set result15=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result15% NEQ 0 goto NEXTPROJ
cd bin
ren Tests-debug.apk Tests-debug-15.apk
cd ..
:NEXTPROJ
::After all test versions completed,changed current API level to the original.(API level:8)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-15" (echo/target=android-8)else echo/%%a
@ -83,18 +95,14 @@ goto success
:error
echo Error.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 1
goto end
:success
echo Success.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 0
goto end
::End.

View File

@ -52,7 +52,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:8).
call ant release
set result8=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10
if %result8% NEQ 0 goto API_10
cd bin
ren Tests-release.apk Tests-release-8.apk
cd ..
:API_10
::Change API level.(API level:10)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-8" (echo/target=android-10)else echo/%%a
@ -65,7 +71,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:10).
call ant release
set result10=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11
if %result10% NEQ 0 goto API_11
cd bin
ren Tests-release.apk Tests-release-10.apk
cd ..
:API_11
::Change API level.(API level:11)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-10" (echo/target=android-11)else echo/%%a
@ -78,7 +90,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:11).
call ant release
set result11=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12
if %result11% NEQ 0 goto API_12
cd bin
ren Tests-release.apk Tests-release-11.apk
cd ..
:API_12
::Change API level.(API level:12)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-11" (echo/target=android-12)else echo/%%a
@ -91,7 +109,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:12).
call ant release
set result12=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13
if %result12% NEQ 0 goto API_13
cd bin
ren Tests-release.apk Tests-release-12.apk
cd ..
:API_13
::Change API level.(API level:13)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-12" (echo/target=android-13)else echo/%%a
@ -104,7 +128,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:13).
call ant release
set result13=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result13% NEQ 0 goto NEXTPROJ
cd bin
ren Tests-release.apk Tests-release-13.apk
cd ..
:NEXTPROJ
::After all test versions completed,changed current API level to the original.(API level:8)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-13" (echo/target=android-8)else echo/%%a
@ -132,18 +162,14 @@ goto :eof
:error
echo Error.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 1
goto end
:success
echo Success.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 0
goto end
::End.

View File

@ -57,7 +57,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:14).
call ant release
set result14=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15
if %result14% NEQ 0 goto API_15
cd bin
ren Tests-release.apk Tests-release-14.apk
cd ..
:API_15
::Change API level.(API level:15)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-14" (echo/target=android-15)else echo/%%a
@ -70,7 +76,13 @@ move ant1.properties ant.properties
::Android ant build(release,API level:15).
call ant release
set result15=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTRPOJ
if %result15% NEQ 0 goto NEXTPROJ
cd bin
ren Tests-release.apk Tests-release-15.apk
cd ..
:NEXTPROJ
::After all test versions completed,changed current API level to the original.(API level:8)
for /f "delims=" %%a in (ant.properties) do (
if "%%a"=="target=android-15" (echo/target=android-8)else echo/%%a
@ -98,18 +110,14 @@ goto :eof
:error
echo Error.
git checkout -f
git clean -df -x
pause
::git checkout -f
::git clean -df -x
exit 1
goto end
:success
echo Success.
git checkout -f
git clean -df -x
pause
exit 0
goto end
::End.

View File

@ -0,0 +1,58 @@
::This script is used to finish a android automated compiler.
::You should make sure have finished the environment setting.
::You should add %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools to Path
::Copy monkeyrunner python script to tools directory.
copy %cd%\Monkeyrunner_TestsCpp.py %ANDROID_HOME%\tools
cd ..\..\..\..
cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory.
copy %cd%\Tests-debug-8.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-10.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-11.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-12.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-13.apk %ANDROID_HOME%\tools
::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2%
%ANDROID_ROOT%
cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(debug,API level:8).
ren Tests-debug-8.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk
::Running monkeyrunner test(debug,API level:10).
ren Tests-debug-10.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
::Running monkeyrunner test(debug,API level:11).
ren Tests-debug-11.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
::Running monkeyrunner test(debug,API level:12).
ren Tests-debug-12.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
::Running monkeyrunner test(debug,API level:13).
ren Tests-debug-13.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
rm Monkeyrunner_TestCpp.py
::Monkeyrunner success!
echo Monkeyrunner Test Success!
git checkout -f
git clean -df -x
exit 0
::End

View File

@ -0,0 +1,40 @@
::This script is used to finish a android automated compiler.
::You should make sure have finished the environment setting.
::You should add %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools to Path
::Copy monkeyrunner python script to tools directory.
copy %cd%\Monkeyrunner_TestsCpp.py %ANDROID_HOME%\tools
cd ..\..\..\..
cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory.
copy %cd%\Tests-debug-14.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-15.apk %ANDROID_HOME%\tools
::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2%
%ANDROID_ROOT%
cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(debug,API level:14).
ren Tests-debug-14.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
::Running monkeyrunner test(debug,API level:15).
ren Tests-debug-15.apk Tests-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-debug.apk
rm Monkeyrunner_TestCpp.py
::Monkeyrunner success!
echo Monkeyrunner Test Success!
git checkout -f
git clean -df -x
exit 0
::End

View File

@ -0,0 +1,58 @@
::This script is used to finish a android automated compiler.
::You should make sure have finished the environment setting.
::You should add %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools to Path
::Copy monkeyrunner python script to tools directory.
copy %cd%\Monkeyrunner_TestsCpp.py %ANDROID_HOME%\tools
cd ..\..\..\..
cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory.
copy %cd%\Tests-release-8.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-10.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-11.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-12.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-13.apk %ANDROID_HOME%\tools
::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2%
%ANDROID_ROOT%
cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(release,API level:8).
ren Tests-release-8.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk
::Running monkeyrunner test(release,API level:10).
ren Tests-release-10.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
::Running monkeyrunner test(release,API level:11).
ren Tests-release-11.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
::Running monkeyrunner test(release,API level:12).
ren Tests-release-12.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
::Running monkeyrunner test(release,API level:13).
ren Tests-release-13.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
rm Monkeyrunner_TestCpp.py
::Monkeyrunner success!
echo Monkeyrunner Test Success!
git checkout -f
git clean -df -x
exit 0
::End

View File

@ -0,0 +1,40 @@
::This script is used to finish a android automated compiler.
::You should make sure have finished the environment setting.
::You should add %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools to Path
::Copy monkeyrunner python script to tools directory.
copy %cd%\Monkeyrunner_TestsCpp.py %ANDROID_HOME%\tools
cd ..\..\..\..
cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory.
copy %cd%\Tests-release-14.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-15.apk %ANDROID_HOME%\tools
::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2%
%ANDROID_ROOT%
cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(release,API level:14).
ren Tests-release-14.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
::Running monkeyrunner test(release,API level:15).
ren Tests-release-15.apk Tests-release.apk
monkeyrunner Monkeyrunner_TestCpp.py
rm Tests-release.apk
rm Monkeyrunner_TestCpp.py
::Monkeyrunner success!
echo Monkeyrunner Test Success!
git checkout -f
git clean -df -x
exit 0
::End

View File

@ -0,0 +1,835 @@
# Imports the monkeyrunner modules used by this program
import sys
import subprocess
import random
from com.android.monkeyrunner import MonkeyRunner as mr
from com.android.monkeyrunner import MonkeyDevice as md
from com.android.monkeyrunner import MonkeyImage as mi
# Connects to the current device, returning a MonkeyDevice object
device = mr.waitForConnection()
if not device:
print >> sys.stderr,"fail"
sys.exit(1)
else:
print "Start......"
# Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked.
#if device.installPackage('Tests-debug.apk'):
# print "Install success!"
#else:
# print "Install failed,please make sure you have put apk in the right places"
# sys.exit(1)
# sets a variable with the package's internal name
package = 'org.cocos2dx.testcpp'
print "Package name: "+ package
# sets a variable with the name of an Activity in the package
activity = 'org.cocos2dx.testcpp.TestCpp'
print "Activity name: " + activity
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
print "Running activity......"
#Set Screen's Length and Width
s_length = 800
s_width = 480
#Set boolean variable of Acticity_IsRunning
Acticity_IsRunning = 1
#Define test functions.
def common_test(a,b,c):
for i in range(a,b):
mr.sleep(c)
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
def random_click(a,b,c):
for i in range(a,b):
touch_x = random.randint(0,s_length/20*19)
touch_y = random.randint(0,s_width)
device.touch(touch_x,touch_y,'DOWN_AND_UP')
mr.sleep(c)
def random_drag(a,b,c):
for i in range(a,b):
drag_x = random.randint(0,s_length/20*18)
drag_y = random.randint(0,s_width)
drop_x = random.randint(0,s_length/20*18)
drop_y = random.randint(0,s_width)
device.drag((drag_x,drag_y),(drop_x,drop_y))
def check_activity(a):
subprocess.call("adb shell ps > running_activities.txt")
subprocess.call("adb pull running_activities.txt")
f1 = open('running_activities.txt')
while True:
line = f1.readline()
if not line.find('org.cocos2dx.testcpp') == -1:
break;
if len(line) == 0:
str = "TestCpp wasn't running,maybe it has crashes,please checkout:"
f2 = file('monkeyrunner_log.txt','w')
f2.write(str)
f2.write(a)
f2.close()
sys.exit(1)
print "subprocess has finished!"
f1.close()
############ActionsTest########
print "Run ActionsTest"
mr.sleep(2.0)
device.touch(s_length/2,s_width/48*5,'DOWN_AND_UP')
#Last Test
#device.touch(s_length/8*3,s_width/16*15,'DOWN_AND_UP')
common_test(1,28,1.0)
common_test(1,3,3.0)
common_test(1,6,1.0)
mr.sleep(1.0)
#Next Test
#device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
print "ActionsTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ActionsTest")
############TransitionsTest####
print "Run TransitionsTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/6,'DOWN_AND_UP')
common_test(1,27,1.0)
mr.sleep(1.0)
print "TransitionsTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("TransitionsTest")
##########ActionsProgressTest##
print "Run ActionsProgressTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*11,'DOWN_AND_UP')
common_test(1,8,2.0)
mr.sleep(1.0)
print "ActionsProgressTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ActionsProgressTest")
#############EffectsTest#######
mr.sleep(1.0)
print "Run EffectsTest"
device.touch(s_length/2,s_width/3,'DOWN_AND_UP')
common_test(1,22,3.0)
mr.sleep(1.0)
print "EffectsTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("EffectsTest")
##########ClickAndMoveTest#####
print "Run ClickAndMoveTest"
mr.sleep(5.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
random_click(1,11,2.0)
mr.sleep(1.0)
random_click(1,101,0.0)
mr.sleep(1.0)
print "ClickAndMoveTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ClickAndMoveTest")
##########RotateWorldTest######
print "Run RotateWorldTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
mr.sleep(5.0)
print "RotateWorldTest finished!"
mr.sleep(3.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("RotateWorldTest")
##########ParticleTest#########
print "Run ParticleTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*7,'DOWN_AND_UP')
common_test(1,43,2.0)
print "ParticleTest finished!"
mr.sleep(2.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ParticleTest")
##########ActionsEaseTest######
print "Run ActionsEaseTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/3*2,'DOWN_AND_UP')
mr.sleep(2.0)
common_test(1,14,2.0)
print "ActionsEaseTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ActionsEaseTest")
##########MotionStreakTest#####
print "Run MontionStreakTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/4*3,'DOWN_AND_UP')
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
random_drag(1,11,0.5)
mr.sleep(1.0)
device.touch(s_length/2,s_width/4*3,'DOWN_AND_UP')
mr.sleep(1.0)
random_drag(1,11,0.5)
print "MontionStreakTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("MontionStreakTest")
##########DrawPrimitivesTest###
print "Run DrawprimitivesTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/6*5,'DOWN_AND_UP')
mr.sleep(1.0)
print "DrawPrimitivesTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("DrawPrimitivesTest")
##############NodeTest#########
print "Run NodeTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*11,'DOWN_AND_UP')
mr.sleep(1.0)
common_test(1,14,1.0)
print "NodeTest finished!"
mr.sleep(3.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("NodeTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
##########TouchesTest##########
print "Run TouchesTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12,'DOWN_AND_UP')
print "TouchesTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("TouchesTest")
##########MenuTest#############
print "Run MenuTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/6,'DOWN_AND_UP')
mr.sleep(1.0)
#Atlas Sprite
device.touch(s_length/2,s_width/48*13,'DOWN_AND_UP')
mr.sleep(1.0)
#Play
device.touch(s_length/8*3,s_width/24*11,'DOWN_AND_UP')
mr.sleep(1.0)
#items
device.touch(s_length/2,s_width/24*11,'DOWN_AND_UP')
device.touch(s_length/2,s_width/24*11,'DOWN_AND_UP')
mr.sleep(1.0)
#Configuration
device.touch(400,260,'DOWN_AND_UP')
mr.sleep(1.0)
print "MenuTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("MenuTest")
##########ActionManagerTest####
print "Run ActionManagerTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*11,'DOWN_AND_UP')
common_test(1,5,3.0)
print "ActionManagerTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ActionManagerTest")
##########LayerTest############
print "Run LayerTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/3,'DOWN_AND_UP')
random_drag(1,11,0.5)
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(2.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(2.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
random_drag(1,11,0.5)
print "LayerTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("LayerTest")
##########SceneTest############
print "Run SceneTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*7,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
print "SceneTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("SceneTest")
##########ParallaxTest##########
print "Run ParallaxTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
mr.sleep(5.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
random_drag(1,11,0.5)
print "ParallaxTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ParallaxTest")
##########TileMapTest##########
print "Run TileMapTest"
#mr.sleep(1.0)
#device.touch(s_length/2,s_width/12*7,'DOWN_AND_UP')
#mr.sleep(2.0)
#for TileMap_i in range(1,20):
# random_drag(1,5,2.0)
# #Next Test
# device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
#mr.sleep(2.0)
print "TileMapTest finished!"
#mr.sleep(1.0)
#MainMenu
#device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("TileMapTest")
#########IntervalTest###########
print "Run IntervalTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/3*2,'DOWN_AND_UP')
mr.sleep(3.0)
device.touch(s_length/2,s_width/12,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/2,s_width/12,'DOWN_AND_UP')
print "IntervalTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("IntervalTest")
######ChipmunkAccelTouchTest####
print "Run ChipmunkAccelTouchTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/4*3,'DOWN_AND_UP')
random_click(1,21,0.1)
print "ChipmunkAccelTouchTest finished!"
mr.sleep(2.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ChipmunkAccelTouchTest")
##########LabelTest#############
print "Run LabelTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/6*5,'DOWN_AND_UP')
mr.sleep(3.0)
common_test(1,26,0.5)
mr.sleep(1.0)
print "LableTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("LabelTest")
##########TestInputTest#########
print "Run TestInputTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*11,'DOWN_AND_UP')
print "TestInputTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("TestInputTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
############SpriteTest##########
print "Run SpriteTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/16,'DOWN_AND_UP')
mr.sleep(1.0)
random_click(1,11,0.1)
mr.sleep(2.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
random_click(1,11,0.1)
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.0)
common_test(1,109,0.5)
print "SpriteTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("SpriteTest")
######SchdulerTest##############
print "Run SchdulerTest"
mr.sleep(2.0)
device.touch(s_length/2,s_width/48*7,'DOWN_AND_UP')
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
#Scheduler timeScale Test
mr.sleep(1.0)
device.drag((s_length/16*9,s_width/8*5),(s_length/16*7,s_width/8*5))
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
#Two custom schedulers
mr.sleep(1.0)
device.drag((s_length/16*5,s_width/24),(s_length/16*3,s_width/24))
mr.sleep(1.0)
common_test(1,11,1)
print "SchdulerTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("SchdulerTest")
##########RenderTextureTest#####
print "Run RenderTextureTest"
#mr.sleep(1.0)
#device.touch(s_length/2,s_width/48*11,'DOWN_AND_UP')
#mr.sleep(1.0)
#random_drag(1,11,0.5)
#mr.sleep(1.0)
#device.touch(s_length/8*7,s_width/24,'DOWN_AND_UP')
#mr.sleep(1.0)
#Next Test
#device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
#mr.sleep(1.0)
#device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
#mr.sleep(1.0)
#Testing Z Buffer in Render Texture
#random_click(1,11,0.1)
#mr.sleep(1.0)
#Next Test
#device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
print "RenderTextureTest finished!"
#mr.sleep(1.0)
#MainMenu
#device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("RenderTextureTest")
#########Testure2DTest##########
print "Run Testure2DTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/16*5,'DOWN_AND_UP')
common_test(1,36,0.5)
print "Testure2DTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("Testure2DTest")
###########Box2dTest############
print "Run Box2dTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*19,'DOWN_AND_UP')
random_click(1,31,0.1)
print "Box2dTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("Box2dTest")
###########Box2dTestBed#########
print "Run Box2dTestBed"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*23,'DOWN_AND_UP')
common_test(1,36,2.0)
print "Box2dTestBed finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("Box2dTestBed")
##########EffectAdvancedTest####
print "Run EffectAdvancedTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/16*9,'DOWN_AND_UP')
common_test(1,6,1.0)
print "EffectAdvancedTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("EffectAdvancedTest")
##########Accelerometer#########
print "Run Accelerometer"
mr.sleep(5.0)
device.touch(s_length/2,s_width/48*31,'DOWN_AND_UP')
mr.sleep(1.0)
print "Accelerometer finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
mr.sleep(3.0)
check_activity("Accelerometer")
#############KeypadTest#########
print "Run KeypadTest"
mr.sleep(3.0)
device.touch(s_length/2,s_width/48*35,'DOWN_AND_UP')
mr.sleep(1.0)
device.press('KEYCODE_BACK','DOWN_AND_UP')
print "KeypadTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("KeypadTest")
########CocosDenshionTest#######
print "Run CocosDenshionTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*39,'DOWN_AND_UP')
#device.touch(400,30,'DOWN_AND_UP')
#device.touch(400,100,'DOWN_AND_UP')
print "CocosDenshionTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("CocosDenshionTest")
##########PerformanceTest########
print "Run PerformanceTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*43,'DOWN_AND_UP')
mr.sleep(1.0)
#PerformanceNodeChildrenTest
device.touch(s_length/2,s_width/12,'DOWN_AND_UP')
mr.sleep(1.0)
for NodeChildren_i in range(1,6):
device.touch(450,240,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.0)
#Back
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
mr.sleep(1.0)
#PerformanceParticleTest
device.touch(s_length/2,s_width/6,'DOWN_AND_UP')
mr.sleep(1.0)
for NodeChildren_i in range(1,5):
device.touch(450,240,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.0)
#Back
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
mr.sleep(1.0)
#PerformanceSpriteTest
device.touch(s_length/2,s_width/4,'DOWN_AND_UP')
mr.sleep(1.0)
for NodeChildren_i in range(1,8):
device.touch(430,80,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(370,80,'DOWN_AND_UP')
mr.sleep(1.0)
#Back
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
mr.sleep(1.0)
#PerformanceTextureTest
#device.touch(s_length/2,s_width/3,'DOWN_AND_UP')
#mr.sleep(1.0)
#Back
#device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
#mr.sleep(1.0)
#PerformanceTouchesTest
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
mr.sleep(1.0)
random_drag(1,11,0.2)
#Next Test
mr.sleep(1.0)
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.0)
random_drag(1,11,0.2)
mr.sleep(1.0)
#Back
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
print "PerformanceTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("PerformanceTest")
#########ZwoptexTest############
print "Run ZwoptexTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/48*47,'DOWN_AND_UP')
print "ZwoptexTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ZwoptexTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
##########CurlTest##############
print "Run CurlTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/4,'DOWN_AND_UP')
mr.sleep(1.0)
random_click(1,2,1.0)
print "CurlTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("CurlTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
##########UserDefaultTest#######
print "Run UserDefaultTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/3,'DOWN_AND_UP')
print "UserDefaultTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("UserDefaultTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
###########BugsTest#############
print "Run BugsTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*5,'DOWN_AND_UP')
print "BugsTest is finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("BugsTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
###########FontTest#############
print "Run FontTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/2,'DOWN_AND_UP')
mr.sleep(1.0)
common_test(1,6,0.5)
mr.sleep(1.0)
print "FontTest finished!"
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("FontTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
#########CurrentLanguageTest####
print "Run CurrentLanguageTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/12*7,'DOWN_AND_UP')
print "CurrentLanguageTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("CurrentLanguageTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
##########TextureCacheTest######
print "Run TextureCacheTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/3*2,'DOWN_AND_UP')
print "TextureCacheTest is finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("TextureCacheTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
#########ExtensionsTest#########
print "Run ExtensionsTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/4*3,'DOWN_AND_UP')
#NotificationCenterTest
mr.sleep(1.0)
device.touch(s_length/2,s_width/12,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/40*23,s_width/2,'DOWN_AND_UP')
mr.sleep(1.0)
device.touch(s_length/40*23,s_width/2,'DOWN_AND_UP')
#Back
mr.sleep(1.0)
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
#CCControlButtonTest
mr.sleep(1.5)
device.touch(s_length/2,s_width/6,'DOWN_AND_UP')
mr.sleep(1.5)
device.drag((s_length/2,s_width/48*25),(s_length/20*13,s_width/48*25))
mr.sleep(1.5)
device.drag((s_length/20*13,s_width/48*25),(s_length/20*7,s_width/48*25))
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/16*7,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/40*19,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.5)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.5)
random_click(1,10,0.1)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.5)
random_click(1,10,0.1)
mr.sleep(1.5)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
mr.sleep(1.5)
random_click(1,10,0.1)
mr.sleep(1.5)
#Back
device.touch(s_length/20*19,s_width/96*91,'DOWN_AND_UP')
mr.sleep(1.5)
#CocosBuilderTest
device.touch(s_length/2,s_width/4,'DOWN_AND_UP')
mr.sleep(1.5)
#Menus & Items
device.touch(s_length/4,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/4,s_width/24*11,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/2,s_width/24*11,'DOWN_AND_UP')
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
#Sprite & 9 Slice
device.touch(s_length/4*3,s_width/2,'DOWN_AND_UP')
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
#Button
device.touch(s_length/4,s_width/8*5,'DOWN_AND_UP')
mr.sleep(1.5)
device.touch(s_length/2,s_width/24*11,'DOWN_AND_UP')
mr.sleep(1.5)
device.drag((s_length/2,s_width/24*11),(s_length/2,s_width/8*5))
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
#Labels
device.touch(s_length/4*3,s_width/8*5,'DOWN_AND_UP')
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
#Particle Systems
device.touch(s_length/40,s_width/4*3,'DOWN_AND_UP')
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
#Scroll Views
device.touch(s_length/4*3,s_width/4*3,'DOWN_AND_UP')
mr.sleep(1.5)
random_drag(1,10,0.2)
mr.sleep(1.5)
#ItemBack
device.touch(s_length/40,s_width/24,'DOWN_AND_UP')
mr.sleep(1.5)
print "ExtensionsTest finished!"
mr.sleep(1.5)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ExtensionsTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
###########ShaderTest###########
print "Run ShaderTest"
mr.sleep(1.0)
device.touch(s_length/2,s_width/6*5,'DOWN_AND_UP')
mr.sleep(7.0)
common_test(1,7,1.0)
mr.sleep(2.0)
device.drag((s_length/2,s_width/3*2),(s_length/80*51,s_width/3*2))
mr.sleep(1.0)
device.drag((s_length/80*51,s_width/3*2),(s_length/80*29,s_width/3*2))
mr.sleep(1.0)
#Next Test
device.touch(s_length/8*5,s_width/16*15,'DOWN_AND_UP')
print "ShaderTest finished!"
mr.sleep(3.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("ShaderTest")
mr.sleep(1.0)
device.drag((s_length/4*3,s_width/16*15),(s_length/4*3,0))
###########MutiTouchTest########
print "Run MutiTouchTest"
mr.sleep(3.0)
device.touch(s_length/2,s_width/12*11,'DOWN_AND_UP')
mr.sleep(1.0)
random_drag(1,10,0.1)
print "MutiTouchTest finished!"
mr.sleep(1.0)
#MainMenu
device.touch(s_length/40*39,s_width/96*91,'DOWN_AND_UP')
check_activity("MutiTouchTest")
############Quit################
mr.sleep(1.0)
device.touch(s_length/80*77,s_width/12,'DOWN_AND_UP')