class ComposeUI(UIATestBase):

    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()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ComposeUI, self).tearDown()
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        clearTmpDir()

    def test_screenshot_imageedit(self):
        ''' refer TC test_screenshot_imageedit
        '''
        print "[RunTest]: %s" % self.__str__()
        self.photosImpl.launch_photos_am()
        self._composeui.addeffects_check_screenshot()
        self.device.press.back()
        time.sleep(2)
        self.photosImpl.open_a_picture()
        self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode, set_wallpaper=False)
        self.photosImpl.stop_photos_am()
class ScreenCastingImagesSlideshowTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenCastingImagesSlideshowTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingImagesSlideshowTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()
        self.photos.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.photos.push_pictures(count=5)

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
            "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        self.photos.clean()
        super(ScreenCastingImagesSlideshowTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(ScreenCastingImagesSlideshowTest, cls).tearDownClass()

    def test_ScreenCasting_ImagesSlideshow(self):
        """
        test_ScreenCasting_ImagesSlideshow

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list.
        2. Connect to the Chromecast.
            The DUT is connected to the Chromecast.
        3. Open the Photos appliaction.
            The Gallery application is opened.
        4. Use Photos application slideshow for 5 minutes to view some pictures.
            The pictures are shown and screencasting has no degradation.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
                    The Chromecast is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast.
                    The DUT is connected to the Chromecast."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Open the Photos appliaction.
                    The Gallery application is opened."""
        self.photos.launch()

        print """[Step] 4. Use Photos application slideshow for 5 minutes to view some pictures.
                    The pictures are shown and screencasting has no degradation."""
        self.photos.slideshow(5 * 60)

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(cast_real_name)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
Esempio n. 3
0
class Camera720pHDVideoRecordingTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(Camera720pHDVideoRecordingTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(Camera720pHDVideoRecordingTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.camera.startApp()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
            "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        super(Camera720pHDVideoRecordingTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(Camera720pHDVideoRecordingTest, cls).tearDownClass()

    def test_Camera_720pHDVideoRecording(self):
        """
        test_Camera_720pHDVideoRecording

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list.
        2. Connect to the Chromecast
            The DUT is connected to the Chromecast .
        3. Start the Camera application.
            The Camera application is opened.
        4. Take some HD 720p video files using Camera app.
            The HD 720p video files are taken and screencasting has no degradation.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
            The Chromecast is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast
            The DUT is connected to the Chromecast."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Start the Camera application.
            The Camera application is opened."""
        self.d.press.home()
        self.camera.launchCamera()

        print """[Step] 4. Take some HD 720p video files using Camera app.
            The HD 720p video files are taken and screencasting has no degradation."""
        self.camera.setVideoTo720p()
        self.camera.videoRecord()

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(cast_real_name)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()
class WallpaperSetGIFImageTest(UIATestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(WallpaperSetGIFImageTest, cls).setUpClass()
        cls.d = g_common_obj.get_device()
        g_common_obj.root_on_device()
        g_common_obj.remount_device()

    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 tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        self.photosImpl.rm_delete_photos()
        self.photosImpl.refresh_sdcard()
        fatal_msg = logcat.get_device_log(self.mark_time, filters='*:F')
        assert len(fatal_msg) == 0, \
            "occurred Fatal error during testing:\n%s" % (fatal_msg)
        super(WallpaperSetGIFImageTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(WallpaperSetGIFImageTest, cls).tearDownClass()

    def test_WallpaperSet_GIFImage(self):
        """
        test_WallpaperSet_GIFImage

        Steps:
        1. Open a GIF picture by Gallery app
        GIF image display is OK.
        2. Select "Set as..." Wallpaper option and crop the picture
        Select wallpaper option and crop the picture are OK.
        3. Back the home UI to check the wallpaer after setting
        The GIF picture can set as wallpaper successfully. DUT has no crash or freeze.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Open a GIF picture by Gallery app
            GIF image display is OK."""
        self.photosImpl.launch_photos_am()
        self.photosImpl.open_a_picture()
        print """[Step] 2. Select "Set as..." Wallpaper option and crop the picture
            Select wallpaper option and crop the picture are OK."""
        self.photosImpl.set_picture_as_wallpaper()
        print """[Step] 3. Back the home UI to check the wallpaer after setting
            The GIF picture can set as wallpaper successfully. DUT has no crash or freeze."""
        self.qrcodeImpl.verify_qrcode_marked_image(self.qrcode)
Esempio n. 5
0
class ScreenCastingOpenTakenPictureTest(ChromeCastTestBase):
    @classmethod
    def setUpClass(cls):
        print "[setUpClass]: %s" % cls.__name__
        super(ScreenCastingOpenTakenPictureTest, cls).setUpClass()

    def setUp(self):
        print "[Setup]:%s" % self.__class__.__name__
        super(ScreenCastingOpenTakenPictureTest, self).setUp()

        cmd = 'date +"%m-%d %H:%M:%S"'
        self.test_time_mark = g_common_obj.adb_cmd_capture_msg(repr(cmd))

        self.chrome_cast = self.IChromeCastImpl(self.cast_model)
        self.camera = CameraExtendImpl()
        self.photos = PhotosExtendImpl()
        self.systemui = SystemUiExtendImpl()

        self.camera.clean()

        self.systemui.unlock_screen()
        self.d.screen.on()
        self.d.orientation = 'natural'

        self.chrome_cast.setup()
        self.photos.setup()
        self.camera.startApp()

    def tearDown(self):
        print "[tearDown]:%s" % self.__class__.__name__
        cmd = 'logcat -d -v time -t "%s.000" *:F|grep -i Fatal' % (
            self.test_time_mark)
        fatal_msg = g_common_obj.adb_cmd_common(cmd)
        assert not fatal_msg,\
                "occurred Fatal error during testing:%s" % (fatal_msg)
        self.camera.clean()
        super(ScreenCastingOpenTakenPictureTest, self).tearDown()

    @classmethod
    def tearDownClass(cls):
        print "[tearDownClass]: %s" % cls.__name__
        super(ScreenCastingOpenTakenPictureTest, cls).tearDownClass()

    def test_ScreenCasting_OpenTakenPicture(self):
        """
        test_ScreenCasting_OpenTakenPicture

        Steps:
        1. Turn on Wireless Display on DUT.
            The Chromecast adapter is shown on the scan list.
        2. Connect to the Chromecast adapter
            The DUT is connected to the Chromecast adapter.
        3. Take a picture using the Camera application
            The picture is taken
        4. Open the Photos application and view the picture
            The picture is opened with Gallery app and screencasting is successful.
        """
        print "[RunTest]: %s" % self.__str__()

        print """[Step] 1. Turn on Wireless Display on DUT.
                    The Chromecast adapter is shown on the scan list."""
        self.turn_on_wireless()

        self.chrome_cast.launch()
        cast_real_name = self.chrome_cast.choose_castscreen(self.cast_model)

        print """[Step] 2. Connect to the Chromecast adapter
                    The DUT is connected to the Chromecast adapter."""
        self.chrome_cast.connect_cast_screen(cast_real_name)

        print """[Step] 3. Take a picture using the Camera application
                    The picture is taken"""
        self.d.press.home()
        self.camera.launchCamera()
        self.camera.picTake()

        print """[Step] 4. Open the Photos application and view the picture
                    The picture is opened with Gallery app and screencasting is successful."""
        self.photos.launch()
        index = self.photos.find_photo()
        self.photos.click_list_item(index)
        time.sleep(5)

        print """[Step] 5. Verify connection.
                    The connection is not lost."""
        self.chrome_cast.watch_connection_status(count=1, step=1)
        self.chrome_cast.verify_connection_from_quick_settings(self.cast_model)

        self.chrome_cast.resume()
        self.chrome_cast.disconnect_cast_screen()