本文整理汇总了Python中uiautomatorplug.android.device.swipe函数的典型用法代码示例。如果您正苦于以下问题:Python swipe函数的具体用法?Python swipe怎么用?Python swipe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了swipe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testLaunchGalleryFromMS
def testLaunchGalleryFromMS(self):
commands.getoutput('adb shell am start -n com.android.videoeditor/.ProjectsActivity')
#self._creatMovieStudioProject()
time.sleep(2)
d.swipe(360,360,361,361) #Hold on the first item in media list
if d(text = 'Delete project').wait.exists(timeout = 2000):
while d(text = 'Delete project').wait.exists(timeout = 2000):
d(text = 'Delete project').click.wait()
if d(text = 'Yes').wait.exists(timeout = 2000):
d(text = 'Yes').click.wait()
time.sleep(2)
d.swipe(360,360,361,361)
if d(text = 'Cancel').wait.exists():
d(text = 'Cancel').click.wait()
else:
d(text = 'Cancel').click.wait()
self.createMovie()
for i in range(0,100):
time.sleep(2)
d(resourceId = 'com.android.videoeditor:id/add_new_media_item_menu').click.wait()
assert d(text = 'Import image').wait.exists(timeout = 1000),'enter import image menu fail'
d(text = 'Import image').click.wait()
time.sleep(1)
self._selectIntelGallery()
self._pressBack(1)
示例2: testDownloadVideo
def testDownloadVideo(self):
#Launch Browser
self._launchBrowser()
# input download audio url
d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('http://pan.baidu.com/s/1eQcRK3o')
d.press('enter')
d.sleep(5)
d.swipe(540,1400,540,400,100)
# click download
d.click(800,1550)
assert d(text = '是否下载该文件?').wait.exists(timeout = 10000), 'Not trigger download. '
d(text = '下载').click.wait()
if d(textContains = '您正在通过移动数据下载').exists:
d(text = '继续').click.wait()
#Looping 60s to check if download is ok
for i in range(60):
if u.getFileCount('/sdcard/Download', 'mp4') > 0:
return
d.sleep(1)
assert False, 'Can not download video in 60s. '
#Close all webpage windows and clear downloaded resource
#self._closeWindows()
self._clearData()
示例3: setCameraSetting
def setCameraSetting(self,mode,sub_mode,option):
'''
This method is used to set camera to one mode, sub-mode, and do any operate of this sub-mode.
7 = Max element count in screen.
2 = Length of settings - Max screen count
Please input index number as sub_mode, input index number of options as option
Such as:
setCameraSetting('single',3,2)
'single' means mode
3 means the index number of Location in sub_mode list
2 means the index number of Location off option in options list
'''
settings = MODE[mode]
if sub_mode== 'flash':
self._setFlashMode(option)
elif sub_mode == 'fdfr':
self._setFDFRMode(option)
else:
d(resourceId = 'com.intel.camera22:id/left_menus_camera_setting').click.wait(timeout=2000)
if sub_mode <= 7:
d(resourceId = HORI_LIST_BUTTON)[sub_mode-1].click.wait()
if len(settings) >= 7:
d(resourceId = HORI_LIST_BUTTON)[option+7-1].click.wait()
else:
d(resourceId = HORI_LIST_BUTTON)[option+len(settings)-1].click.wait()
else:
d.swipe(680,180,100,180)
d(resourceId = HORI_LIST_BUTTON)[sub_mode-2-1].click.wait()
d(resourceId = HORI_LIST_BUTTON)[option+7-1].click.wait()
示例4: _editImage
def _editImage(self,bottombutton,suboption,cropscale=None):
'''
You need just know the NO. of the wanted option, e.g.:
you want to set an image as 'Hue' in 'Colors',
-> _editImage('colors',9)
*Hue is NO.9 in the option list
*An exception, if you set something in geometry(3rd button on the bottom), you may use func like:
-> _editImage('geometry','crop')
*You could just use the string shows on screen
Comparison Table:
NO.| bottombutton | suboption | cropscale
-------+--------------+----------------------+---------------------
1. | fx | int 1 ~ 10 |
2. | border | int 1 ~ 7 |
3. | geometry | str straighten |
| | crop | str 1:1
| | | 4:3
| | | 3:4
| | | 5:7
| | | 7:5
| | | None
| | | Original
| | rotate |
| | flip (*'Mirror') |
4. | colors | int 1 ~ 11 |
-------+--------------+----------------------+---------------------
'''
u.setMenuOptions('Edit')
#Click bottom button
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%bottombutton).click.wait()
if bottombutton == 'geometry':
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%suboption).click.wait()
else:
if suboption < 6:
d()[17 + suboption - 1].click.wait()
#d.click(XITEM + XUNIT * (suboption - 1), YSUB)
elif suboption == 11:
d.swipe(XMAX-1, YSUB, 0, YSUB, 5) #Swipe to the end
#d.click(XITEM + XUNIT * 4, YSUB)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
else:
d.swipe(XMAX-1, YSUB, 0, YSUB, 60) #Swipe the 5th item to the 0 position(out of screen)
#d.click(XITEM + XUNIT * (suboption - ITEMCOUNT - 1), YSUB)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
#When croping image, there are some expend options
if cropscale != None:
d(resourceId = 'com.intel.android.gallery3d:id/aspect').click.wait()
d(text = cropscale).click.wait()
#Some effect may need user's applying
if d(text = 'Apply').wait.exists(timeout = 2000):
d(text = 'Apply').click.wait()
#Save the changed image
d(text = 'SAVE').click.wait()
示例5: _editImage
def _editImage(self,bottombutton,suboption,cropscale=None):
'''
You need just know the NO. of the wanted option, e.g.:
you want to set an image as 'Hue' in 'Colors',
-> _editImage('colors',9)
*Hue is NO.9 in the option list
*An exception, if you set something in geometry(3rd button on the bottom), you may use func like:
-> _editImage('geometry','crop')
*You could just use the string shows on screen
Comparison Table:
NO.| bottombutton | suboption | cropscale
-------+--------------+----------------------+---------------------
1. | fx | int 1 ~ 10 |
2. | border | int 1 ~ 7 |
3. | geometry | str straighten |
| | crop | str 1:1
| | | 4:3
| | | 3:4
| | | 5:7
| | | 7:5
| | | None
| | | Original
| | rotate |
| | flip (*'Mirror') |
4. | colors | int 1 ~ 11 |
-------+--------------+----------------------+---------------------
'''
d(resourceId = 'com.intel.android.gallery3d:id/action_edit').click.wait()
if d(text = 'Choose an action').wait.exists():
d(text = 'com.intel.android.gallery3d').click.wait()
#Click bottom button
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%bottombutton).click.wait()
if bottombutton == 'geometry':
d(resourceId = 'com.intel.android.gallery3d:id/%sButton'%suboption).click.wait()
else:
if suboption < 10:
d()[24 + suboption].click.wait()
elif suboption == 11:
d.swipe(self._getSubSize()[0]-1, self._getSubSize()[1], 0, self._getSubSize()[1], 5)
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
else:
d.swipe(self._getSubSize()[0]-1, self._getSubSize()[1], 0, self._getSubSize()[1])
d(index = suboption-1,focusable = 'false',clickable = 'true').click.wait()
#When croping image, there are some expend options
if cropscale != None:
d(resourceId = 'com.intel.android.gallery3d:id/aspect').click.wait()
d(text = cropscale).click.wait()
#Some effect may need user's applying
if d(text = 'Apply').wait.exists(timeout = 2000):
d(text = 'Apply').click.wait()
#Save the changed image
d(description = 'SAVE').click.wait()
示例6: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(360,980,719,980)
示例7: _slideOptionRightToLeft
def _slideOptionRightToLeft(self, optiontext):
# <<<---
x_1 = (self._getSettingBounds())[0] - (self._getOptionWidthAndHeight())[0]
x_2 = (
(self._getSettingBounds())[0] - (self._getOptionWidthAndHeight())[0] - (self._getOptionWidthAndHeight())[0]
)
y = self._getOptionOrdinate(optiontext)
d.swipe(x_1, y, x_2, y)
示例8: _slideOptionRightToLeft
def _slideOptionRightToLeft(self,optiontext,diffindex):
# <<<---
x_1 = self._getSettingBounds()[0] - self._getOptionWidthAndHeight()[0]
x_2 = self._getSettingBounds()[0] - self._getOptionWidthAndHeight()[0] - self._getOptionWidthAndHeight()[0]
y = self._getOptionOrdinate(optiontext)
x_i = self._getOptionWidthAndHeight()[0] * (diffindex - 1)
d.swipe(x_1, y, x_2 - x_i, y)
time.sleep(2)
示例9: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(530,1300,1000,1300)
u._clearAllResource()
示例10: launchSettings
def launchSettings():
d.start_activity(component='com.android.settings/.Settings')
while d(resourceId = 'smartisanos:id/btn_back').exists:
d(resourceId = 'smartisanos:id/btn_back').click.wait()
if not d(text = '无线网络').exists:
for i in range(4):
if d(text = '无线网络').exists:
break
d.swipe(360,200,360,1000,50)
assert d(text = '设置').wait.exists(timeout = 5000),'Launch settings failed in 5s!'
示例11: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(360,980,719,980)
u._clearAllResource()
u._checkBurstResource()
u.launchGallery()
self._enterBurstView()
示例12: selectOption
def selectOption(option):
i = 1
while i:
if d(text = option).exists:
break
d.swipe(540,1400,540,400,100)
d.sleep(1)
i+=1
if d(text = option).exists or i==10:
break
d.sleep(1)
d(text = option).click.wait()
示例13: selectPictueWhenEditBurst
def selectPictueWhenEditBurst(self,imagesSelect):
#Could display 5 pictures on selection bar at most, when the count of image selected bigger than 5, need swipe
x = 70 #The abscissa of the first picture
while imagesSelect > 0:
d.click(x, 250)
time.sleep(1) #Sometimes case failed if tap action is too fast
x = x + 150 #The gap between two pictures are 150 pix
if x > 700: #The left boundry of the fifth image, so if abscissa over than 600, need swipe
d.swipe(650,250,1,250,steps=5)
time.sleep(1)
x = 70 #Reset the first abscissa
imagesSelect = imagesSelect - 1
示例14: testTagOnePicture
def testTagOnePicture(self):
u._confirmResourceExists()
u.launchGallery()
u.enterXView('fullview')
u.showPopCard()
u.setMenuOptions('Details')
for i in range(100):
d.swipe(500,1050,500,200) #Swipe detail list up
d(resourceId = 'com.intel.android.gallery3d:id/addKeywordButton').click.wait()
d(text = 'Enter new keyword').click.wait() #Make sure keyboard has been invoked
d(text = 'Enter new keyword').set_text('NewKeyword')
self._tapOnDoneButton()
assert d(text = 'NewKeyword',className = 'android.widget.TextView').wait.exists(timeout = 2000)
示例15: setUp
def setUp(self):
super(GalleryTest,self).setUp()
#Add on May 26th due to device always reboot by itself
if d(text = 'Charged').wait.exists(timeout = 2000):
commands.getoutput('adb root')
time.sleep(5)
commands.getoutput('adb remount')
d.swipe(530,1300,1000,1300)
u._clearAllResource()
u._confirmResourceExists()
u.launchGallery()
u.enterXView('fullview')
u.showPopCard()