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()
Exemplo n.º 2
0
 def testLaunchGalleryFromMS(self):
     commands.getoutput(
         'adb shell am start -n com.android.videoeditor/.ProjectsActivity')
     #self._creatMovieStudioProject()
     time.sleep(2)
     d.swipe(550, 550, 551, 551)  #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(550, 550, 551, 551)
             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)
    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()
Exemplo n.º 4
0
	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()
Exemplo n.º 5
0
 def testCancelDeleteAllAlbum(self):
     """
     Summary: Cancel Delete all album
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album to select it
     3. Tap Select Album Dropdown
     4. Select Select all option to select all the albums
     5. Tap Delete icon
     6. Tap Cancel Delete option
     7. Exit SocialGallery app
     """
     # Step 2
     d.swipe(550, 1100, 551, 1101)
     # Step 3
     d(text='1 selected').click()
     # Step 4
     d(text='Select all').click()
     # Step 5 + Step 6
     u.deleteItem('Cancel')
     # confirm Cancel Delete complete
     result = commands.getoutput(
         'adb shell ls -l /sdcard/testalbum/testpictures1 | grep jpg | wc -l'
     )
     if string.atoi(result) == 0:
         self.fail('Cancel delete failed!')
Exemplo n.º 6
0
    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()
 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)
Exemplo n.º 8
0
    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()
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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)
 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)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 def _slideOptionLeftToRight(self, optiontext, diffindex):
     # --->>>
     x_1 = self._getSettingBounds()[0] - self._getOptionWidthAndHeight()[0]
     x_2 = self._getSettingBounds()[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)
Exemplo n.º 14
0
 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()
Exemplo n.º 15
0
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!'
 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    
Exemplo n.º 17
0
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()
 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()
Exemplo n.º 19
0
 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()
Exemplo n.º 20
0
 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, 360)
         time.sleep(1) #Sometimes case failed if tap action is too fast
         x = x + 200 #The gap between two pictures are 150 pix
         if x > 1000: #The left boundry of the fifth image, so if abscissa over than 600, need swipe
             d.swipe(1000,360,1,360,steps=5)
             time.sleep(1)
             x = 100 #Reset the first abscissa
         imagesSelect = imagesSelect - 1
 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._confirmResourceExists()
     u.launchGallery()
     u.enterXView('fullview')
     u.showPopCard()
 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)
Exemplo n.º 23
0
 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()
 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._confirmResourceExists()
     u.launchGallery()
     u.enterXView('fullview')
     self._turnFDFR('On')
     self._removeIdentity()
Exemplo n.º 25
0
 def testAddKeyWords(self):
     '''
         Summary: Add keywords by setting meny 
         Steps:   1.Enter full view
                  2.Add keywords in settings bar
                  3.Click “+” to add new keywords to this photo
     '''
     u.setMenuOptions('Details')
     d.swipe(1000,1600,1000,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)
Exemplo n.º 26
0
 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')
     self._turnFDFR('On')
     self._removeIdentity()
Exemplo n.º 27
0
	def testVisitWebPage4G(self):
		# turn off wifi
		self._setWifistatus('off')
		d.sleep(3)

		#Launch Browser
		self._launchBrowser()
		# visite webpage
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text(TOP5[3])
		d.press('enter')
		d.expect(CHECK_POINT[3], timeout=15)
		# browse webpage
		d.swipe(1000,1300,1000,600,10)
		d.sleep(1)
		d.swipe(1000,1300,1000,600,10)
		d.sleep(1)
		d.swipe(1000,600,1000,1300,10)
		d.sleep(1)
		d.swipe(1000,600,1000,1300,10)
		d.sleep(1)

		# turn on wifi
		self._setWifistatus('on')
		d.start_activity(component='com.android.browser/.BrowserActivity')
		assert d(resourceId = 'com.android.browser:id/switch_btn').wait.exists(timeout = 5000),'Launch browser failed in 5s!'
Exemplo n.º 28
0
 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)
     # clear test resource
     #self.util = util.Util
     u._clearAllResource()
     # push test pics.
     u._confirmResourceExists()
     # launch gallery
     u.launchGallery()
Exemplo n.º 29
0
def selectOption(option):
	i = 1
	while i:
		if d(text = option).exists:
			break
			return True
		d.swipe(360,1000,360,200,50)
		d.sleep(1)
		i+=1
		if i==10:
			assert d(text = option).wait.exists(timeout = 3000),'%s is not in the list!'%option
			break
			return False
	d.sleep(1)
	d(text = option).click.wait()
Exemplo n.º 30
0
 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)
     # clear test resource
     # self.util = util.Util
     u._clearAllResource()
     # push test pics.
     u._confirmResourceExists()
     # launch gallery
     u.launchGallery()
Exemplo n.º 31
0
def unlock():
	'''
	unlock() 解锁屏幕,黑屏或其他状态解锁屏幕。
	return boolean
	'''
	d.wakeup()
	lockscreen = d(className = 'android.widget.ImageView',resourceId = 'com.smartisanos.keyguard:id/desk_kg')
	if lockscreen.exists:
		x = d.info['displayWidth']
		y = d.info['displayHeight']
		d.swipe(x/2,int(y/1.5),x/2,0,20)
		if not lockscreen.exists:
			return True
		else:
			return False
Exemplo n.º 32
0
 def testSharePictureInGridViewWithYouTube(self):
     """
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or a video to select
     4.Tap share icon
     5.Tap YouTube option
     """
     u._prepareVideo()
     time.sleep(2)
     # Step 3
     d.swipe(355,575,356,576)
     # Step 4 + Step 5
     u.shareItem('YouTube')
     # confirm enter YouTube
     assert d(text = 'Choose an account').wait.exists(timeout = 2000)
Exemplo n.º 33
0
 def testCheckAlbumDetail(self):
     """
     Summary: Check details
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap Extra menu Icon
     4. Tap Details option
     5. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(550,1100,551,1101)
     # Step 3 + Step 4
     u.setMenuOptions('Details')
     # confirm pop up details dialog
     assert d(text = '1 of 2 items:').wait.exists
Exemplo n.º 34
0
 def testSharePictureInGridViewWithYouTube(self):
     """
     1.Launch gallery activity 
     2.Enter Grid view
     3.Long touch a pic or a video to select
     4.Tap share icon
     5.Tap YouTube option
     """
     u._prepareVideo()
     time.sleep(2)
     # Step 3
     d.swipe(355,575,356,576)
     # Step 4 + Step 5
     u.shareItem('YouTube')
     # confirm enter YouTube
     assert d(text = 'Choose an account').wait.exists(timeout = 2000)
Exemplo n.º 35
0
 def setUp(self):
     super(CameraTest,self).setUp()
     #Delete all image/video files captured before
     ad.cmd('rm','/sdcard/DCIM/*')
     #Refresh media after delete files
     ad.cmd('refresh','/sdcard/DCIM/*')
     if d(resourceId = 'com.android.keyguard:id/glow_pad_view').wait.exists(timeout = 3000):
         d.swipe(366,905,666,905,steps=5) 
         ad.cmd('adb root')
         time.sleep(2)
         ad.cmd('adb remount')
     #Launch social camera
     self._ClearData()
     time.sleep(2)
     self._launchCamera()
     time.sleep(2)
 def testCheckAlbumDetail(self):
     """
     Summary: Check details
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap Extra menu Icon
     4. Tap Details option
     5. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4
     u.setMenuOptions('Details')
     # confirm pop up details dialog
     assert d(text = '1 of 2 items:').wait.exists
Exemplo n.º 37
0
 def testAddKeyWords(self):
     '''
         Summary: Add keywords by setting meny 
         Steps:   1.Enter full view
                  2.Add keywords in settings bar
                  3.Click “+” to add new keywords to this photo
     '''
     u.setMenuOptions('Details')
     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)
 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)
     # clear test resource
     #self.util = util.Util
     u._clearAllResource()
     # push test pics.
     u._confirmResourceExists()
     # launch gallery
     u.launchGallery()
     # enter grid view
     u.enterXView('gridview')
Exemplo n.º 39
0
 def testTagOnePicture(self):
     u._confirmResourceExists()
     u.launchGallery()
     u.enterXView('fullview')
     u.showPopCard()
     u.setMenuOptions('Details')
     for i in range(100):
         d.swipe(1000, 1600, 1000, 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)
 def testCancelDeleteAlbum(self):
     """
     Summary: Cancel Delete an album
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap Delete icon
     4. Select Cancle option to cancel delete
     5. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4
     u.deleteItem('Cancel')
     # confirm Delete complete
     result = commands.getoutput('adb shell ls -l /sdcard/testalbum/testpictures1 | grep jpg | wc -l')
     if string.atoi(result) == 0:
         self.fail('Cancel delete failed!')
Exemplo n.º 41
0
 def testShareAlbumViaGmail(self):
     """
     Summary: Share album via Gmail
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Gmail option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2
     d.swipe(550, 1100, 551, 1101)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Gmail')
     # confirm enter Gamil
     assert d(text='Subject').wait.exists(timeout=2000)
 def testShareAlbumViaGmail(self):
     """
     Summary: Share album via Gmail
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Gmail option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Gmail')
     # confirm enter Gamil
     assert d(text = 'Subject').wait.exists(timeout = 2000)
 def testShareAlbumViaDrive(self):
     """
     Summary: Share album via Drive
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Drive option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Drive')
     # confirm enter Driver
     assert d(text = 'Upload to Drive').wait.exists(timeout = 2000)
Exemplo n.º 44
0
 def testShareAlbumViaDrive(self):
     """
     Summary: Share album via Drive
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Drive option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(550,1100,551,1101)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Drive')
     # confirm enter Driver
     assert d(text = 'Upload to Drive').wait.exists(timeout = 2000)
Exemplo n.º 45
0
 def testShareAlbumViaFacebook(self):
     """
     Summary: Share album via Facebook
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Facebook option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(550,1100,551,1101)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Facebook')
     # confirm enter Facebook
     assert d(text = 'Loading...').wait.exists(timeout = 2000)
Exemplo n.º 46
0
 def testCancelDeleteAlbum(self):
     """
     Summary: Cancel Delete an album
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap Delete icon
     4. Select Cancle option to cancel delete
     5. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(550,1100,551,1101)
     # Step 3 + Step 4
     u.deleteItem('Cancel')
     # confirm Delete complete
     result = commands.getoutput('adb shell ls -l /sdcard/testalbum/testpictures1 | grep jpg | wc -l')
     if string.atoi(result) == 0:
         self.fail('Cancel delete failed!')
 def testShareAlbumViaPicasa(self):
     """
     Summary: Share album via Picasa
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Picasa option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Picasa')
     # confirm enter Picasa
     assert d(text = 'Upload 20 photos/videos').wait.exists(timeout = 2000)
Exemplo n.º 48
0
 def testShareAlbumViaPicasa(self):
     """
     Summary: Share album via Picasa
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Picasa option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(550,1100,551,1101)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Picasa')
     # confirm enter Picasa
     assert d(text = 'Upload 20 photos/videos').wait.exists(timeout = 2000)
 def testShareAlbumViaFacebook(self):
     """
     Summary: Share album via Facebook
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Facebook option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Facebook')
     # confirm enter Facebook
     assert d(text = 'Loading...').wait.exists(timeout = 2000)
 def testShareAlbumViaYouTube(self):
     """
     Summary: Share album via YouTube
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap YouTube option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     u._prepareVideo()
     time.sleep(2)
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('YouTube')
     # confirm enter YouTube
     assert d(text = 'Choose an account').wait.exists(timeout = 2000)
 def testShareAlbumViaBluetooth(self):
     """
     Summary: Share album via Bluetooth
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Bluetooth option
     6. Back to SocialGallery app
     7.Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Bluetooth')
     if d(text = 'Turn on').wait.exists(timeout = 2000):
         d(text = 'Turn on').click.wait()
     # confirm enter Bluetooth
     assert d(text = 'Bluetooth device chooser').wait.exists(timeout = 3000)
Exemplo n.º 52
0
 def _swipeCaptureList(self,mode): 
     mode_index = CONFIRM_MODE_LIST.index(mode)    
     result = commands.getoutput('adb shell cat /data/data/com.intel.camera22/shared_prefs/mode_selected.xml| grep currentMode')
     a = str(result)
     b = a[a.index('value="') + 1:a.rindex('/')]
     cmode = b[b.index('"') + 1:b.rindex('"')]
     cmodenew = int(cmode)
     modenew = Mode[cmode]
     currentindex = CONFIRM_MODE_LIST.index(modenew)
     tg_mode =  mode_index -currentindex
     if tg_mode < 0:
         for i in range(abs(tg_mode)):
             # mode image coordinate: right_x_coordinate = 2252 left_x_coordinate = 2252. swipe from right to left.
             d.swipe(2120,944,2252,944)
     if tg_mode == 0:
         #print ('current is ' + mode + ' mode')
         d.press('back')
     if tg_mode > 0:
         for i in range(tg_mode):
             # mode image coordinate: right_x_coordinate = 2252 left_x_coordinate = 2252. swipe from right to left.
             d.swipe(2252,944,2120,944)
 def testShareAlbumViaMessaging(self):
     """
     Summary: Share album via Messaging
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Messaging option
     6. Back to SocialGallery app
     7. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Messaging')
     # confirm enter Messaging
     assert d(text = 'New message').wait.exists(timeout = 2000)
     # Step 6
     u.pressBack(2)
     d(text = 'OK').click()
Exemplo n.º 54
0
 def testDeleteAlbum(self):
     """
     Summary: Delete an album
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap Delete icon
     4. Select Delete option to confirm delete
     5. Exit SocialGallery app
     """
     # Step 2
     d.swipe(550, 1100, 551, 1101)
     # Step 3 + Step 4
     u.deleteItem('Delete')
     time.sleep(2)
     # confirm Delete complete
     result = commands.getoutput(
         'adb shell ls -l /sdcard/testalbum/testpictures1 | grep jpg | wc -l'
     )
     if string.atoi(result) != 0:
         self.fail('delete failed in 2s!')
Exemplo n.º 55
0
 def selectImages(self,selectCount):
     d.swipe(FIRSTITEM_X,FIRSTITEM_Y,FIRSTITEM_X + 1,FIRSTITEM_Y + 1)
     selectCount = selectCount - 1
     x = FIRSTITEM_X
     y = FIRSTITEM_Y + FIRSTITEM_Y
     while selectCount > 0:
         d.click(x, y)
         time.sleep(1)
         y = y + FIRSTITEM_Y
         #When y touch the boundry it means that it need swiching y back to the top
         if y > BODY_BOUNDS['bottom']:
             x = x + UNIT_WIDTH
             y = FIRSTITEM_Y
         #When x touch the boundry, it means that the images on the screen have all been highlighted. Need slide screen to a new page(without selected)
         if x > BODY_BOUNDS['right']:
             for i in range(0,COLUMN_MAX):
                 d.swipe(UNIT_WIDTH*2, FIRSTITEM_Y, UNIT_WIDTH, FIRSTITEM_Y, steps = 20)
                 time.sleep(1)
             #Reset x, y
             x = FIRSTITEM_X
             y = FIRSTITEM_Y
         selectCount = selectCount - 1    
 def testShareAlbumViaGooglePlus(self):
     """
     Summary: Share album via Google+
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album thumbnail to select it
     3. Tap share icon
     4. Tap See all option
     5. Tap Google+ option
     6. Back to SocialGallery app
     7. Exit SocialGallery app
     """
     # Step 2 
     d.swipe(355,575,356,576)
     # Step 3 + Step 4 + Step 5
     u.shareItem('Google+')
     if d(text = 'Choose account').wait.exists(timeout = 2000):
         u.tapOnCenter()
     # confirm enter Google+
     assert d(packageName = 'com.google.android.apps.plus').wait.exists(timeout = 2000)
     u.pressBack(1)
     d(text = 'Yes').click()
Exemplo n.º 57
0
 def shareItem(self,shareto = None):
     '''
         The function simulate user sharing items in gallery.
         Usage:
             If you want to share item with Facebook(this item at the bottom of the share list as default)
             
             -> shareItem('Facebook')
             
             *Do not write press menu/share icon step before using
     '''
     d(description = 'Share').click.wait() #Its description is 'Share' in each view
     if shareto != None:
         try:
             assert d(text = shareto).wait.exists(timeout = 2000)
         except:
             d(text = 'See all').click.wait() #Display all share path
         finally:
             try:
                 assert d(text = shareto).wait.exists(timeout = 2000)
             except:
                 d.swipe(900,1300,900,200) #Slide share list up
             finally:
                 d(text = shareto).click.wait() #Tap on the path you want to share to
 def testSelectDeselectAllAlbums(self):
     """
     Summary: select albums via long tap on the album, then select all, deselect all albums
     Steps: 
     1. Launch SocialGallery app
     2. Long tap on an album to select it
     3. Tap Select Album Dropdown
     4. Tap Select all option
     5. Tap Select Album Dropdown
     6. Tap Deselect all option
     7. Exit SocialGallery app
     """
     # Step 2 + Step 3
     d.swipe(355,575,356,576)
     d(text = '1 selected').click()        
     # Step 4
     d(text = 'Select all').click()
     assert d(description = 'Switch to camera').wait.exists
     # Step 5
     #d(text = '2 selected').click()
     d(textContains = 'selected').click()
     # Step 6
     d(text = 'Deselect all').click()
     assert d(description = 'Switch to camera').wait.exists
    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()
Exemplo n.º 60
0
 def _slideSettingListUp(self):
     x = self._getSettingBounds()[3]
     y_1 = self._getSettingBounds()[2] - self._getOptionWidthAndHeight()[1]
     y_2 = self._getSettingBounds()[1] - self._getOptionWidthAndHeight()[1]
     d.swipe(x, y_1, x, y_2)
     time.sleep(2)