class ImageView(UIATestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() push_pics = ['webp' + str(i) for i in range(1, 11)] for i in push_pics: self.photos.deploy_photo_content("content_picture_webp", i) def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageView, self).tearDown() self.photos.rm_delete_photos() def test_ImageView_Than10WEBPImages_FullScreen(self): ''' refer TC test_ImageView_FullscreenOneByOne_WBMP ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.check_image_fullscreen_onebyone(10) self.photos.stop_photos_am()
class ImageView(PhotoTestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.deploy_photo_content("content_picture", "wbmp") def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageView, self).tearDown() self.photos.rm_delete_photos() def test_imageview_wbmp_fullscreen_rotate(self): ''' refer TC test_ImageView_WBMP_FullScreen_Rotate ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.wbmp_fullscreen_rotate() self._imageviewer.stop_app_am()
class ImageView(PhotoTestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() push_pics = ['jpeg' + str(i) for i in range(1, 4)] for i in push_pics: self.photos.deploy_photo_content("content_picture_jpeg", i) push_pics = ['webp' + str(i) for i in range(1, 4)] for i in push_pics: self.photos.deploy_photo_content("content_picture_webp", i) def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageView, self).tearDown() self.photos.rm_delete_photos() def test_ImageView_CheckEdgeWithSlidingLeftRight(self): ''' refer TC test_ImageView_CheckEdgeWithSlidingLeftRight ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.check_image_fullscreen_onebyone(6) self.photos.stop_photos_am()
class ImageView(PhotoTestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() name = ["gif3", "gif7", "gif8", "gif9", "gif10", "gif11"] for i in name: self.photos.deploy_photo_content("content_picture_gif", i) def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageView, self).tearDown() self.photos.rm_delete_photos() def test_ImageView_gif_ImageSize2M(self): ''' refer TC test_ImageView_gif_ImageSize2M ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.check_image_fullscreen_onebyone(6) self.photos.stop_photos_am()
class ImageView(UIATestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self._imageviewer = ImageDetails() self.photos = get_photo_implement() self.photos.rm_delete_photos() push_pics = ['bmp' + str(i) for i in range(1, 7)] for i in push_pics: self.photos.deploy_photo_content("content_picture_bmp", i) def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageView, self).tearDown() self.photos.rm_delete_photos() def test_ImageView_Slideshow_BMP(self): ''' refer TC test_ImageView_Slideshow_BMP ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.imageView_sildeshow() self.photos.stop_photos_am()
class CheckImageDetails(PhotoTestBase): @classmethod def setUpClass(self): """ install apk """ super(CheckImageDetails, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.deploy_photo_content('Pictures', 'picture_002') self.pic_path = file_sys.get_file_list("/sdcard/Pictures")[0] def setUp(self): super(CheckImageDetails, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._checkDetails = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(CheckImageDetails, self).tearDown() self.photos.rm_delete_photos() def test_check_image_details_gif(self): # self.photos.launch_photos_am() # self.photos.open_a_picture() self.photos.open_image_command(self.pic_path) time.sleep(3) self.photos.view_picture_details() self._checkDetails.check_detail() self.photos.stop_photos_am()
def tearDown(self): print "[Teardown]: %s" % self._test_name super(ComposeUI, self).tearDown() self._composeui.delete_local_video() self.photos.rm_delete_photos() self.photos.refresh_sdcard() ImageDetails.delete_picture() ImageDetails.set_workaround()
def setUpClass(self): """ set environment """ super(ImageEdit, self).setUpClass() self.photos = get_photo_implement() self._imageviewer = ImageDetails() self.photos.rm_delete_photos() self.photos.deploy_photo_content("content_picture", "bmp")
def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self._imageviewer = ImageDetails() self.photos = get_photo_implement() self.photos.rm_delete_photos() push_pics = ['bmp' + str(i) for i in range(1, 7)] for i in push_pics: self.photos.deploy_photo_content("content_picture_bmp", i)
class ImageEdit(PhotoTestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageEdit, self).setUpClass() self.photos = get_photo_implement() self._imageviewer = ImageDetails() self.photos.rm_delete_photos() self.photos.deploy_photo_content("content_picture", "bmp") def setUp(self): super(ImageEdit, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageEdit, self).tearDown() self.photos.rm_delete_photos() self.photos.stop_photos_am() clearTmpDir() def test_imageedit_addeffects_screenshot_homescreen(self): ''' refer TC test_imageedit_addeffects_screenshot_homescreen ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.AddEffects_Screenshot_HomeScreen() self.photos.stop_photos_am()
def setUp(self): super(ComposeUI, self).setUp() self._test_name = __name__ self.device = g_common_obj.get_device() print "[Setup]: %s" % self._test_name self._composeui = ComposeUiImpl() self._imageviewer = ImageDetails() self.photos = PhotosExtendImpl() self.photosImpl = get_photo_implement() self.qrcodeImpl = QRcode() g_common_obj.root_on_device() g_common_obj.remount_device() self.photosImpl.rm_delete_photos() self.photosImpl.refresh_sdcard() self.photos.clean() self.qrcode = "GIFPICTURE" config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration('artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'qrcode_marked_image') self.qrcode = cfg.get("screenshot_edit_qrcode") print "[Debug] qrcode:%s" % (self.qrcode) arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("screenshot_edit_image") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') self.photosImpl.refresh_sdcard() special_actions.setup() self.photos.setup()
class CheckImageDetails(PhotoTestBase): @classmethod def setUpClass(self): """ install apk """ super(CheckImageDetails, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.refresh_sdcard() config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration('artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_picture') arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("bmp") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') self.pic_path = '/sdcard/Pictures/' + os.path.basename(file_path) ImageDetails.set_workaround() def setUp(self): super(CheckImageDetails, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._checkDetails = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(CheckImageDetails, self).tearDown() self.photos.rm_delete_photos() self.photos.refresh_sdcard() def test_check_image_details_bmp(self): # self.photos.launch_photos_am() # self.photos.open_a_picture() self.photos.open_image_command(self.pic_path) time.sleep(3) self.photos.view_picture_details() self._checkDetails.check_detail() self.photos.stop_photos_am()
def setUpClass(self): """ set environment """ super(ImageView, self).setUpClass() self._imageviewer = ImageDetails() self.device = g_common_obj.get_device() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.deploy_photo_content("content_picture", "wbmp5")
class ImageEdit(UIATestBase): @classmethod def setUpClass(self): """ install apk """ super(ImageEdit, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.refresh_sdcard() config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_picture') arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("bmp") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') ImageDetails.set_workaround() def setUp(self): super(ImageEdit, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageEdit, self).tearDown() self.photos.rm_delete_photos() self.photos.refresh_sdcard() def test_imageedit_rotaterightmorethan6times(self): ''' refer TC test_ImageEdit_RotateRightMoreThan6times ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self._imageviewer.open_photo_and_rotate_right_7times() self.photos.stop_photos_am()
def setUpClass(self): """ install apk """ super(ImageEdit, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.refresh_sdcard() config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_picture') arti = Artifactory(cfg_arti.get('location')) pic_name = cfg.get("bmp") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') ImageDetails.set_workaround()
def setUp(self): print "[Setup]:%s" % self.__class__.__name__ super(WallpaperSetGIFImageTest, self).setUp() self.photos = PhotosExtendImpl() self.camera = CameraExtendImpl() self.systemui = SystemUiExtendImpl() self.photosImpl = get_photo_implement() self.qrcodeImpl = QRcode() self.wallpaper = WallpaperImpl() self.systemui.unlock_screen() self.d.screen.on() self.d.press.menu() self.photos.clean() self.camera.clean() self.photosImpl.rm_delete_photos() self.photosImpl.refresh_sdcard() self.wallpaper.reset_wallpaper() self.qrcode = "GIFPICTURE" config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'qrcode_marked_image') arti = Artifactory(cfg_arti.get('location')) self.qrcode = cfg.get("imageviewing_qrcode") print "[Debug] qrcode:%s" % (self.qrcode) pic_name = cfg.get("imageviewing_image") file_path = arti.get(pic_name) g_common_obj.adb_cmd_common('push ' + file_path + ' /sdcard/Pictures') ImageDetails.set_workaround() self.photos.setup() self.mark_time = logcat.get_device_time_mark()
def setUpClass(self): """ set environment """ super(ImageViewThumbnailsMode, self).setUpClass() self.device = g_common_obj.get_device() self._imageviewer = ImageDetails() self.photos = get_photo_implement() self.photos.rm_delete_photos() push_pics = ['jpeg' + str(i) for i in range(1, 5)] for i in push_pics: self.photos.deploy_photo_content("content_picture_jpeg", i)
class ImageEdit(UIATestBase): @classmethod def setUpClass(self): """ set environment """ super(ImageEdit, self).setUpClass() self.photos = get_photo_implement() self.photos.rm_delete_photos() self.photos.deploy_photo_content("content_picture", "bmp") def setUp(self): super(ImageEdit, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails() def tearDown(self): print "[Teardown]: %s" % self._test_name super(ImageEdit, self).tearDown() self.photos.rm_delete_photos() self._imageviewer.clean_tmp() def test_ImageEdit_ContinouslyRotate_SaveImage(self): ''' refer TC test_ImageEdit_ContinouslyRotate_SaveImage ''' print "[RunTest]: %s" % self.__str__() self.photos.launch_photos_am() self.photos.open_a_picture() self.photos.click_crop_tools() im1 = multi_display.get_screenshot_forMultiDisplay(0) # --------Rotate left or right-------- for _ in range(4): self.photos.rotate_90_degrees() sleep(3) im2 = multi_display.get_screenshot_forMultiDisplay(0) assert compare_pic.compare_pic(im1, im2) < 5, "Got diff between two pics." self.photos.stop_photos_am()
def tearDown(self): print "[Teardown]: %s" % self._test_name super(ComposeUI, self).tearDown() ImageDetails.delete_picture() ImageDetails.set_workaround() g_common_obj.set_vertical_screen()
def setUp(self): super(CheckImageDetails, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._checkDetails = ImageDetails()
def __init__(self): self.tmpdir = getTmpDir() self._imageviewer = ImageDetails() self._device = g_common_obj.get_device() self._locator = Locator(self._device)
def tearDown(self): print "[Teardown]: %s" % self._test_name super(ComposeUI, self).tearDown() ImageDetails.delete_picture() ImageDetails.set_workaround()
def setUp(self): super(ImageView, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name self._imageviewer = ImageDetails()
class MeituPicEdit: ''' MeituPicEdit ''' pkg_name = "com.mt.mtxx.mtxx" activity_name = "com.meitu.mtxx.MainActivity" def __init__(self): self.tmpdir = getTmpDir() self._imageviewer = ImageDetails() self._device = g_common_obj.get_device() self._locator = Locator(self._device) def launch_app_am(self): """ Launch MeituPic via adb am command """ print "Launch MeituPic by adb am" g_common_obj.launch_app_am(\ MeituPicEdit.pkg_name, MeituPicEdit.activity_name) time.sleep(2) @staticmethod def stop_app_am(): """ Stop MeituPic via adb am command """ print "Stop MeituPic by adb am" g_common_obj.stop_app_am(MeituPicEdit.pkg_name) @staticmethod def fresh_sdcard(): """ fresh sdcard to let the picture display after push """ cmd = 'am broadcast -a android.intent.action.MEDIA_MOUNTED \ -d file:///sdcard/Pictures' g_common_obj.adb_cmd(cmd) def choose_pic(self): """ choose picture to edit """ self._locator.edit.click.wait() time.sleep(2) self._locator.choose_pic.click.wait() time.sleep(2) self._device(resourceId="com.mt.mtxx.mtxx:id/album_thumb").click.wait() time.sleep(2) def edit_pic(self): """ edit picture """ self._locator.edit_btn.click.wait() time.sleep(2) self._locator.crop_btn.click.wait() time.sleep(2) def mirror_effect(self): """ edit picture as mirro effect """ self._locator.edit_btn.click.wait() time.sleep(2) self._locator.rotate_btn.click.wait() time.sleep(1) self._locator.tip_info_btn.click.wait() time.sleep(1) self._locator.mirrot_horizontal_btn.click.wait() time.sleep(2) def save_pic(self): """ save edit picture """ self._locator.ok_btn.click.wait() time.sleep(1) self._locator.save_btn.click.wait() time.sleep(5) assert self._device( text="Saved to Album").exists, "pictures saved failed" def mirror_effect_check(self, md5_list): """ check mirror effect """ print "get template picture name" comp = g_common_obj.adb_cmd_capture_msg('ls /sdcard/DCIM/Camera/*.jpg') compare = comp.strip("\n") print "template file: " + compare g_common_obj.adb_cmd_common('pull ' + compare + ' ' + self.tmpdir + '/compare.jpg') md5 = make_md5.make_md5_jumpbyte(176, self.tmpdir + '/compare.jpg') assert self._imageviewer.Md5_list_check( md5, md5_list), "check add effect fail" def mirror_effect_check_(self, file_path): """ check mirror effect """ print "get template picture name" comp = g_common_obj.adb_cmd_capture_msg('ls /sdcard/DCIM/Camera/*.jpg') compare = comp.strip("\n") print "template file: " + compare g_common_obj.adb_cmd_common('pull ' + compare + ' ' + self.tmpdir + '/compare.jpg') assert g_common_obj.shell_cmd( "diff -q %s %s" % (file_path, self.tmpdir + '/compare.jpg')) != '0', "check add effect fail" def uninstall_app(self): """ uninstall MeituPic """ print "uninstall MeituPic" cmd = 'uninstall %s' % MeituPicEdit.pkg_name g_common_obj.adb_cmd_common(cmd)