Example #1
0
 def set_livewallpaper_by_desktop(self, wallpaper):
     """ set live wallpaper by desktop
     """
     print "Set live wallpaper by desktop"
     self.launch_set_wallpaper_by_desktop()
     try:
         self._device(text="Wallpapers").click.wait()
         time.sleep(1)
     except:
         print "can't find text 'Wallpapers'"
     if not self._device(text=wallpaper).exists:
         self._device().scroll.horiz.to(text=wallpaper)
         time.sleep(1)
         self._device(text=wallpaper).click.wait()
         time.sleep(4)
     else:
         self._device(text=wallpaper).click.wait()
         time.sleep(4)
     try:
         self._device(textContains="Set wallpaper").click.wait()
     except:
         print "Can't find text 'Set wallpaper'"
     time.sleep(2)
     self._device.press.home()
     time.sleep(1)
     g_common_obj.assert_exp_happens()
Example #2
0
 def test_RefreshRate_Display_before_and_after_playing_video(self):
     self.photosImpl.deploy_photo_content('Videos', 'video_007', '/sdcard/Movies')
     video_file = file_sys.get_file_list('/sdcard/Movies')[0]
     assert logcat.get_refresh_rate() >= 60, 'Refresh rate is less than 60.'
     self.photosImpl.play_video_command(video_file, 10)
     g_common_obj.assert_exp_happens()
     assert logcat.get_refresh_rate() >= 60, 'Refresh rate is less than 60.'
Example #3
0
    def test_Vsync_FPSTool(self):
        """
        test_Vsync_FPSTool

        Steps:
        1. Quickly swipe hoemscreen and immediately execute command:
         adb shell dumpsys SurfaceFlinger | grep "VSYNC state", try again if it is "disabled".
        2. Launch GLbenchmark 2.7 and start performance test at the same time.
        3. After finished test, check FPS result from result xml.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. adb shell dumpsys SurfaceFlinger | grep "VSYNC state"
        """
        thread.start_new_thread(self.capture_state, (30, ))
        self.benchmark.launch()

        # for _ in range(0, 3):
        #     _, activity = self.systemui.get_current_focus()
        #     if not activity == "com.wt.fpstest.activities.MainActivity":
        #         print "[DEBUG]Launch FpsTest.apk failed, Trying to relaunch it."
        #         g_common_obj.launch_app_am("com.wt.fpstest", "com.wt.fpstest.activities.MainActivity")
        #     else:
        #         break
        self.benchmark.run_performance_test("test23")
        print """[Step] 2. Catch fps value after finish test.
        """
        result = self.benchmark.check_all_results()[0]['fps']
        fps_val = int(re.findall(r'\d+', result)[0])
        print "fps result is: %d." % fps_val
        assert fps_val >= 55,\
            "Test failed, fps is: %d." % fps_val
        g_common_obj.assert_exp_happens()
 def set_livewallpaper_HoloSpiral(self):
     """ set live wallpaper with HoloSpiral
     """
     self._device.press.home()
     x = self._device.info["displayWidth"]
     y = self._device.info["displayHeight"]
     for _ in range(0, 3):
         self._device.long_click(x / 2, y * 7 / 8)
         if self._device(text="Wallpapers").exists:
             break
         else:
             self._device.long_click(x / 4, y * 7 / 8)
             if self._device(text="Wallpapers").exists:
                 break
     self._device(text="Wallpapers").click.wait()
     time.sleep(1)
     self._device(scrollable=True).scroll.horiz.toEnd()
     time.sleep(1)
     self._device(text="Holo Spiral").click.wait()
     time.sleep(4)
     self._device(text="Set wallpaper").click.wait()
     time.sleep(2)
     self._device.press.home()
     time.sleep(1)
     g_common_obj.assert_exp_happens()
 def set_livewallpaper_BlackHole(self):
     """ set live wallpaper with BlackHole
     """
     print "Set live wallpaper with BlackHole"
     self._device.press.home()
     x = self._device.info["displayWidth"]
     y = self._device.info["displayHeight"]
     for _ in range(0, 3):
         self._device.long_click(x / 2, y * 7 / 8)
         if self._device(text="Wallpapers").exists:
             break
         else:
             self._device.long_click(x / 4, y * 7 / 8)
             if self._device(text="Wallpapers").exists:
                 break
     self._device(text="Wallpapers").click.wait()
     time.sleep(1)
     self._device(scrollable=True).scroll.horiz.toEnd()
     time.sleep(1)
     self._device(text="Black Hole").click.wait()
     time.sleep(4)
     self._device(text="Set wallpaper").click.wait()
     time.sleep(2)
     self._device.press.home()
     time.sleep(1)
     self.change_to_landscape()
     time.sleep(4)
     g_common_obj.assert_exp_happens()
     self.change_to_vertical()
     self.suspend_resume_device()
     g_common_obj.assert_exp_happens()
Example #6
0
 def run_case(self):
     """ run the binary file and check the result
     """
     assert g_common_obj.adb_cmd_capture_msg(
         '/data/app/' + self.file_name +
         "| grep Success"), "The test failed"
     g_common_obj.assert_exp_happens()
Example #7
0
 def capture_20_times(self):
     """ Capture pictures continues 20 times
     """
     for _ in range(0, 20):
         self.d(resourceId="com.android.camera2:id/shutter_button").click()
         time.sleep(1)
         g_common_obj.assert_exp_happens()
Example #8
0
 def test_GPU_Composition_Mesa(self):
     assert logcat.check_dumpsys_SurfaceFlinger_info(
         True, 'GLES.*Mesa', 'Mesa'), "It's not mesa."
     self.benchmark.launch()
     self.benchmark.run_performance_test("test25")
     self.benchmark.check_all_results()
     g_common_obj.assert_exp_happens()
 def test_LiveWallpaper_PreviewAndSetAs(self):
     ''' refer TC test_LiveWallpaper_PreviewAndSetAs
     '''
     print "[RunTest]: %s" % self.__str__()
     self._liveWallpaper.launch_set_livewallpaper_by_Settings()
     time.sleep(10)
     #         self._device(text="Wallpapers").click.wait()
     #         for i in range (0,len(self.livewallpaper)):
     #             time.sleep(1)
     #             try:
     #                 self._device(scrollable=True).scroll.horiz.to(text=self.livewallpaper[i])
     #                 time.sleep(1)
     #                 self._device(text=self.livewallpaper[i]).click.wait()
     #                 time.sleep(4)
     #             except:
     #                 print "Can't find text: " + self.livewallpaper[i]
     #             g_common_obj.assert_exp_happens()
     #             if i !=len(self.livewallpaper):
     #                 self._device.press.back()
     #             else:
     #                 self._device(text="Set wallpaper").click.wait()
     #                 time.sleep(2)
     #                 self._device.press.home()
     #                 time.sleep(1)
     #                 g_common_obj.assert_exp_happens()
     g_common_obj.assert_exp_happens()
Example #10
0
 def set_wallpaper_by_desktop(self, wallpaper):
     """ set wallpaper by desktop
         The wallpaper parameter just need the number of description from uiautomator,
         Eg:description=Wallpaper 7 of 10;you just need imput 7 as parameter;
         To distinguish total number is 10 or 11,it depends on android M or android L.
     """
     print "Set wallpaper by desktop"
     version_array = osversion.get_android_version()
     androidversion = version_array[0]
     if androidversion == 7:
         print "osversion is N"
         wallpaper = "Wallpaper %s of 10" % (wallpaper)
     elif androidversion == 6:
         print "osversion is M"
         wallpaper = "Wallpaper %s of 10" % (wallpaper)
     elif androidversion == 5:
         print "osversion is L"
         wallpaper = "Wallpaper %s of 11" % (wallpaper)
     else:
         print "osversion is %s" % (androidversion)
         wallpaper = "Wallpaper %s of 11" % (wallpaper)
     self.launch_set_wallpaper_by_desktop()
     self._device(text="Wallpapers").click.wait()
     time.sleep(1)
     self._device(scrollable=True).scroll.horiz.to(description=wallpaper)
     time.sleep(1)
     self._device(description=wallpaper).click.wait()
     time.sleep(4)
     self._device(textContains="Set wallpaper").click.wait()
     time.sleep(2)
     self._device.press.home()
     time.sleep(1)
     g_common_obj.assert_exp_happens()
 def test_photogrid(self):
     print "edit a picture using  apk photogrid"
     self._photogrid_edit.launch_app_am()
     self._photogrid_edit.choose_pic()
     self._photogrid_edit.edit_pic()
     self._photogrid_edit.save_pic()
     g_common_obj.assert_exp_happens()
     self._photogrid_edit.stop_app_am()
 def test_meitupic(self):
     print "edit a picture using  apk metupic"
     self._meitupic_edit.launch_app_am()
     self._meitupic_edit.choose_pic()
     self._meitupic_edit.edit_pic()
     self._meitupic_edit.save_pic()
     g_common_obj.assert_exp_happens()
     self._meitupic_edit.stop_app_am()
Example #13
0
 def switch_to_front_camera_rs(self):
     """ switch to front camera
     """
     self.d(resourceId="com.android.rs.livepreview:id/cameras_selection"
            ).click()
     self.d(text="Camera 1").click()
     g_common_obj.assert_exp_happens()
     time.sleep(3)
Example #14
0
 def run_hwui_unitest_case(self, case_name):
     """ run the binary file and check the result
     """
     output = g_common_obj.adb_cmd_capture_msg('/data/app/hwui_unit_tests' +
                                               ' --gtest_filter=' +
                                               case_name)
     assert output.find(
         "PASSED") != -1, "The test failed,output is %s" % output
     g_common_obj.assert_exp_happens()
 def test_Display_RefreshRate(self):
     print "[RunTest]: %s" % self.__str__()
     self.displaymetrics.compare_refresh_rate()
     self.photos.play_video_command(self.remote_path)
     #         self.photos.launch_photos_am()
     #         self.photos.play_video()
     time.sleep(10)
     self.photos.stop_photos_am()
     g_common_obj.assert_exp_happens()
Example #16
0
 def play_video_and_pause_resume(self):
     """ play video in photos and pause resume
     """
     print "play video in photos"
     self.photos.play_video()
     self.photos.pause_play_video()
     time.sleep(3)
     self.photos.resume_play_video()
     g_common_obj.assert_exp_happens()
 def test_imageview_jpeg_fullscreen(self):
     ''' refer TC test_ImageView_JPEG_FullScreen
     '''
     print "[RunTest]: %s" % self.__str__()
     self.photos.launch_photos_am()
     self.photos.open_a_picture()
     self.photos.view_a_picture_fullscreen()
     g_common_obj.assert_exp_happens()
     self.photos.stop_photos_am()
Example #18
0
 def test_ImageEdit_VerticallyOrHorizontally(self):
     ''' refer TC test_ImageEdit_VerticallyOrHorizontally
     '''
     print "[RunTest]: %s" % self.__str__()
     PhotoGridEdit().launch_app_am()
     PhotoGridEdit().choose_pic()
     PhotoGridEdit().function_add_image()
     PhotoGridEdit().save_pic()
     g_common_obj.assert_exp_happens()
     PhotoGridEdit().stop_app_am()
 def test_ImageView_ByWebBrowser_WEBP(self):
     ''' refer TC test_ImageView_ByWebBrowser_WEBP
     '''
     print "[RunTest]: %s" % self.__str__()
     self._chrome.launch()
     self._chrome.open_website("file:///mnt/sdcard/Pictures/%s" %
                               self.pic_name)
     time.sleep(3)
     self._qrcode.verify_qrcode_marked_image(self.qrcode, False)
     g_common_obj.assert_exp_happens()
Example #20
0
 def test_delete_one_image(self):
     self.photos.launch_photos_am()
     before_num = self.photos.check_pic_number()
     self.photos.delete_photos_in_a_folder("Pictures", 1)
     self.photos.open_local_folder()
     after_num = self.photos.check_pic_number()
     assert before_num - after_num == 1, "delete photos failed,before num is %s,after num is %s" % (
         before_num, after_num)
     g_common_obj.assert_exp_happens()
     self.photos.stop_photos_am()
 def test_viewfinderdisplays_videomode_primarycamera(self):
     '''
     Run test with uiautomator instead of GITS.
     '''
     print "[RunTest]: %s" % self.__str__()
     self._extendcamera.launch_camera_am()
     self._extendcamera.cameraSwitchTo("Video")
     time.sleep(3)
     assert not self.device(
         text="Camera error").exists, "Camera popups 'Camera error'"
     g_common_obj.assert_exp_happens()
 def test_SettingMenu_Rotate(self):
     print "[RunTest]: %s" % self.__str__()
     common.launch_settings_am()
     self.device.orientation = "l"
     time.sleep(1)
     self.device.orientation = "r"
     time.sleep(1)
     self.device.orientation = "n"
     time.sleep(1)
     g_common_obj.assert_exp_happens()
     common.stop_settings_am()
 def test_ViewfinderDisplays_VideoMode_SecondaryCamera(self):
     ''' refer TC test_ViewfinderDisplays_VideoMode_SecondaryCamera
     '''
     print "[RunTest]: %s" % self.__str__()
     self._extendcamera.launch_camera_am()
     self._extendcamera.cameraSwitchTo("Video")
     self._extendcamera.cameraSwitchBackFront("front")
     time.sleep(3)
     assert not self.device(
         text="Camera error").exists, "Camera popups 'Camera error'"
     g_common_obj.assert_exp_happens()
Example #24
0
 def test_YouTube_VideoPlayback(self):
     print "[RunTest]: %s" % self.__str__()
     html5.check_chrome_installed()
     youtube_video_url, youtube_video_key = chrome_impl.get_youtube_url_key(
         'american_bobtail', 'key_american_bobtail')
     g_common_obj.assert_exp_happens()
     chrome_impl.launch()
     chrome_impl.chrome_setup()
     chrome_impl.open_website(youtube_video_url)
     chrome_impl.web_check(youtube_video_key, 15)
     chrome_impl.enter_youtube_fullscreen(10)
 def test_videorecording_severalclips(self):
     ''' refer TC test_VideoRecording_SeveralClips
     '''
     print "[RunTest]: %s" % self.__str__()
     self._extendcamera.launch_camera_am()
     self._extendcamera.capture_video("1")
     self._extendcamera.stop_camera_am()
     self._photos.launch_photos_am()
     self._photos.play_video("Camera")
     time.sleep(10)
     g_common_obj.assert_exp_happens()
     self._photos.stop_photos_am()
Example #26
0
 def open_photo_and_rotate_left_7times(self):
     """ open photo and rotate left 7times
     """
     self.photos.open_a_picture()
     time.sleep(1)
     self.photos.click_crop_tools()
     time.sleep(2)
     for _ in range(0, 7):
         self.photos.rotate_90_degrees()
         time.sleep(1)
     g_common_obj.assert_exp_happens()
     self._device.press.back()
 def test_liveWallpaper_suspendResume(self):
     ''' refer TC test_LiveWallpaper_SuspendResume
     '''
     print "[RunTest]: %s" % self.__str__()
     #         self._liveWallpaper.set_livewallpaper_by_desktop("Black Hole")
     self._liveWallpaper.set_livewallpaper_by_Settings()
     self._device.press.home()
     time.sleep(5)
     self._device.screen.off()
     time.sleep(3)
     self._device.screen.on()
     g_common_obj.assert_exp_happens()
Example #28
0
 def imageView_sildeshow(self):
     """ open images and Sildeshow
     """
     self.photos.open_a_picture()
     self.photos.pictures_slideshow()
     time.sleep(2)
     for n in range(0, 5):
         time.sleep(4)
         print "check image:%s" % (n + 2)
         g_common_obj.assert_exp_happens()
         assert not self._device(
             description="More options").exists, 'check full screen fail'
Example #29
0
 def test_ImageView_ThumbnailMode_WBMP_SmallSize1k(self):
     ''' refer TC test_ImageView_ThumbnailMode_WBMP_SmallSize1k
     '''
     print "[RunTest]: %s" % self.__str__()
     self.photos.launch_photos_am()
     g_common_obj.assert_exp_happens()
     self.photos.view_pictures_in_thumbnailsMode()
     g_common_obj.assert_exp_happens()
     assert not self.device(
         text="Couldn't load photo"
     ).exists, "view 1k WBMP failed, and popup 'Couldn't load photo'"
     self.photos.stop_photos_am()
 def test_HDMI_TakePicture(self):
     """
     test_HDMI_TakePicture
     """
     print "[RunTest]: %s" % self.__str__()
     self.HDMI_switch_card.switch_on()
     self.camera.startApp()
     self.camera.picTake()
     self.photosImpl.launch_photos_am()
     self.photosImpl.delete_photos_in_a_folder("Camera", 1)
     self.camera.videoRecord()
     g_common_obj.assert_exp_happens()
     self.HDMI_switch_card.switch_off()