当前位置: 首页>>代码示例>>Python>>正文


Python app.Gallery类代码示例

本文整理汇总了Python中gaiatest.apps.gallery.app.Gallery的典型用法代码示例。如果您正苦于以下问题:Python Gallery类的具体用法?Python Gallery怎么用?Python Gallery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Gallery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_app

    def prepare_app(self):
        picture_count = 100
        self.device.b2gpopulate.populate_pictures(picture_count)

        # launch the gallery app and wait for the thumbnails to be displayed,
        # the first launch after populating the data takes a long time.
        gallery = Gallery(self.device.marionette)
        gallery.app = self.device.gaiaApps.launch('Gallery')
        time.sleep(5)
        timeout = 200
        starttime = time.time()
        while (time.time() - starttime) < timeout:
            try:
                items = self.device.marionette.find_elements(
                    *gallery._gallery_items_locator)
                progress = self.device.marionette.find_element(
                    *gallery._progress_bar_locator)
                if len(items) == picture_count and not progress.is_displayed():
                    break
            except (NoSuchElementException, StaleElementException):
                pass
            time.sleep(0.5)
        else:
            raise TimeoutException('Gallery items not displayed')
        self.device.gaiaApps.kill(gallery.app)
开发者ID:retornam,项目名称:eideticker,代码行数:25,代码来源:gallery.py

示例2: tap_gallery

 def tap_gallery(self):
     self.marionette.find_element(*self._gallery_button_locator).tap()
     self.wait_for_element_not_displayed(*self._actions_menu_locator)
     from gaiatest.apps.gallery.app import Gallery
     gallery = Gallery(self.marionette)
     gallery.switch_to_gallery_frame()
     return gallery
开发者ID:axraf,项目名称:gaia,代码行数:7,代码来源:activities.py

示例3: tap_confirm_deletion_button

 def tap_confirm_deletion_button(self):
     self.marionette.find_element(*self._confirm_delete_locator).tap()
     self.wait_for_element_not_displayed(*self._confirm_delete_locator)
     from gaiatest.apps.gallery.app import Gallery
     gallery = Gallery(self.marionette)
     gallery.launch()
     return gallery
开发者ID:Ms2ger,项目名称:gaia-ui-tests,代码行数:7,代码来源:fullscreen_image.py

示例4: tap_switch_to_gallery

 def tap_switch_to_gallery(self):
     switch_to_gallery_button = self.marionette.find_element(*self._gallery_button_locator)
     switch_to_gallery_button.tap()
     from gaiatest.apps.gallery.app import Gallery
     gallery_app = Gallery(self.marionette)
     gallery_app.wait_to_be_displayed()
     self.apps.switch_to_displayed_app()
     return gallery_app
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:8,代码来源:app.py

示例5: test_gallery_crop_photo

    def test_gallery_crop_photo(self):
        gallery = Gallery(self.marionette)
        gallery.launch()
        gallery.wait_for_files_to_load(1)

        image = gallery.tap_first_gallery_item()
        initial_scale = image.current_scale

        # Tap on Edit button.
        edit_image = image.tap_edit_button()
        edit_image.tap_edit_crop_button()
        edit_image.tap_portrait_crop()

        gallery = edit_image.tap_edit_save_button()

        gallery.wait_for_files_to_load(2)

        # Verify new Photo is created
        self.assertEqual(2, gallery.gallery_items_number)

        image1 = gallery.tap_first_gallery_item()

        # The logic is: scale is inversely proportional with the size(witdh*height) of the image
        # if initial_scale < image1.current_scale then image > image1
        self.assertLess(initial_scale, image1.current_scale)
开发者ID:Allan019,项目名称:gaia,代码行数:25,代码来源:test_gallery_crop_photo.py

示例6: test_gallery_handle_load_corrupt_file

    def test_gallery_handle_load_corrupt_file(self, filename):
        self.push_resource(filename)

        gallery = Gallery(self.marionette)
        gallery.launch(True)
        self.assertTrue(len(self.data_layer.picture_files) == 1)

        # image will not display in the gallery app
        Wait(self.marionette).until(lambda m: gallery.empty_gallery_text == 'Use the Camera app to get started.')
        self.assertTrue(gallery.gallery_items_number == 0)
        self.assertEqual(gallery.empty_gallery_title, 'No photos or videos')
开发者ID:AaskaShah,项目名称:gaia,代码行数:11,代码来源:test_gallery_handle_invalid_file.py

示例7: test_empty_gallery

    def test_empty_gallery(self):
        """https://moztrap.mozilla.org/manage/case/4003/"""
        # Requires there to be no photos on SDCard which is the default

        gallery = Gallery(self.marionette)
        gallery.launch(True)

        self.wait_for_condition(lambda m: gallery.empty_gallery_text == 'Use the Camera app to get started.')

        # Verify empty gallery title
        self.assertEqual(gallery.empty_gallery_title, 'No photos or videos')
开发者ID:AaskaShah,项目名称:gaia,代码行数:11,代码来源:test_gallery_empty.py

示例8: test_empty_gallery

    def test_empty_gallery(self):
        # https://moztrap.mozilla.org/manage/case/4003/
        # Requires there to be no photos on SDCard which is the default

        gallery = Gallery(self.marionette)
        gallery.launch()

        # Verify empty gallery title
        self.assertEqual(gallery.empty_gallery_title, 'No photos or videos')

        # Verify empty gallery text
        self.assertEqual(gallery.empty_gallery_text, 'Use the Camera app to get started.')
开发者ID:AaronMT,项目名称:gaia-ui-tests,代码行数:12,代码来源:test_gallery_empty.py

示例9: TestEnduranceGalleryFlick

class TestEnduranceGalleryFlick(GaiaEnduranceTestCase):

    images = 'IMG_0001.jpg'
    image_count = 10

    def setUp(self):
        GaiaEnduranceTestCase.setUp(self)

        # Add photos to storage.
        self.push_resource(self.images, count=self.image_count)

        # Start gallery app
        self.gallery = Gallery(self.marionette)
        self.gallery.launch()
        self.gallery.wait_for_files_to_load(self.image_count)
        self.assertTrue(self.gallery.gallery_items_number >= self.image_count)

        # Tap first image to open full screen view.
        self.image = self.gallery.tap_first_gallery_item()

    def test_endurance_gallery_flick(self):
        self.drive(test=self.gallery_flick, app='gallery')

    def gallery_flick(self):
        # Flick through images in gallery, and back again
        # Original code taken from existing webqa test (test_gallery_flick.py, thanks!)
        previous_image_source = None

        # Check the next flicks.
        for i in range(self.gallery.gallery_items_number):
            self.assertIsNotNone(self.image.current_image_source)
            self.assertNotEqual(self.image.current_image_source, previous_image_source)
            self.assertTrue(self.image.is_photo_toolbar_displayed)
            previous_image_source = self.image.current_image_source
            self.image.flick_to_next_image()

        self.assertIsNotNone(self.image.current_image_source)
        self.assertEqual(self.image.current_image_source, previous_image_source)
        self.assertTrue(self.image.is_photo_toolbar_displayed)

        # Check the prev flick.
        for i in range(self.gallery.gallery_items_number - 1):
            self.image.flick_to_previous_image()
            self.assertIsNotNone(self.image.current_image_source)
            self.assertNotEqual(self.image.current_image_source, previous_image_source)
            self.assertTrue(self.image.is_photo_toolbar_displayed)
            previous_image_source = self.image.current_image_source

        # Try to flick prev image (No image should be available)
        self.image.flick_to_previous_image()
        self.assertIsNotNone(self.image.current_image_source)
        self.assertEqual(self.image.current_image_source, previous_image_source)
        self.assertTrue(self.image.is_photo_toolbar_displayed)
开发者ID:4gh,项目名称:gaia,代码行数:53,代码来源:test_endurance_gallery_flick.py

示例10: tap_gallery

 def tap_gallery(self):
     actions_menu = Wait(self.marionette).until(
         expected.element_present(*self._actions_menu_locator))
     Wait(self.marionette).until(
         expected.element_displayed(actions_menu))
     self.marionette.find_element(*self._gallery_button_locator).tap()
     Wait(self.marionette).until(
         expected.element_not_displayed(actions_menu))
     from gaiatest.apps.gallery.app import Gallery
     gallery = Gallery(self.marionette)
     gallery.wait_to_be_displayed()
     self.apps.switch_to_displayed_app()
     return gallery
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:13,代码来源:activities.py

示例11: test_gallery_edit_photo

    def test_gallery_edit_photo(self):
        gallery = Gallery(self.marionette)
        gallery.launch()
        gallery.wait_for_files_to_load(1)

        self.assertTrue(gallery.gallery_items_number > 0)

        image = gallery.tap_first_gallery_item()

        # Tap on Edit button.
        edit_image = image.tap_edit_button()

        # Tap on Effects button.
        edit_image.tap_edit_effects_button()

        # Change effects.
        [effect.tap() for effect in edit_image.effects]

        # TBD. Verify the photo is changed.

        gallery = edit_image.tap_edit_save_button()
        gallery.wait_for_files_to_load(2)

        # Verify new Photo is created
        self.assertEqual(2, gallery.gallery_items_number)
开发者ID:AaronMT,项目名称:gaia-ui-tests,代码行数:25,代码来源:test_gallery_edit_photo.py

示例12: test_gallery_crop_photo

    def test_gallery_crop_photo(self):
        gallery = Gallery(self.marionette)
        gallery.launch()
        gallery.wait_for_files_to_load(1)

        initial_image_size = gallery.thumbnails[0].absolute_image_size
        image = gallery.tap_first_gallery_item()

        # Tap on Edit button.
        edit_image = image.tap_edit_button()
        edit_image.tap_edit_crop_button()
        # portrait crop is 2:3 and will retain the image's height
        edit_image.tap_portrait_crop()
        edit_image.tap_edit_tool_apply_button()

        image = edit_image.tap_edit_save_button()
        gallery = image.go_back()
        gallery.wait_for_files_to_load(2)

        # get the absolute image for the new first image
        cropped_image_size = gallery.thumbnails[0].absolute_image_size

        # As we have chosen portrait crop, height will remain the same, width should change
        self.assertEqual(cropped_image_size['height'], initial_image_size['height'])
        self.assertLess(cropped_image_size['width'], initial_image_size['width'])
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:25,代码来源:test_gallery_crop_photo.py

示例13: TestEnduranceGalleryCamera

class TestEnduranceGalleryCamera(GaiaEnduranceTestCase):

    def setUp(self):
        GaiaEnduranceTestCase.setUp(self)

        # Turn off geolocation prompt
        self.apps.set_permission('Camera', 'geolocation', 'deny')

        # add photo to storage
        self.push_resource('IMG_0001.jpg')

        self.gallery = Gallery(self.marionette)
        self.gallery.launch()
        self.gallery.wait_for_files_to_load(1)

    def test_endurance_gallery_camera(self):
        self.drive(test=self.gallery_camera, app='gallery')

    def gallery_camera(self):
        # Test requested per bug 851626:
        # 1. open the Gallery app
        # 2. when the UI/Camera button appears, tap it to switch to the camera
        # 3. when the UI/Gallery button appears, tap it to switch back to the gallery
        # 4. repeat steps 2 and 3 until *crash*
        time.sleep(3)

        # From gallery app, switch to camera app
        self.camera = self.gallery.switch_to_camera()
        time.sleep(3)

        # From camera app, switch back to gallery again
        self.gallery = self.camera.tap_switch_to_gallery()
        self.gallery.wait_for_files_to_load(1)
        self.assertTrue(self.gallery.are_gallery_items_displayed)
开发者ID:4gh,项目名称:gaia,代码行数:34,代码来源:test_endurance_gallery_camera.py

示例14: test_gallery_handle_load_corrupt_file

    def test_gallery_handle_load_corrupt_file(self, filename):
        self.push_resource(filename)

        gallery = Gallery(self.marionette)
        gallery.launch(filename != "image_formats/x07.jpg")

        self.assertTrue(len(self.data_layer.picture_files) == 1)

        # loaded image will not display in the gallery app, except in case of corrupt_jpg
        if filename == "image_formats/x07.jpg":
            self.assertTrue(gallery.gallery_items_number == 1)
            # make sure the file opens without crash
            image = gallery.tap_first_gallery_item()
            self.assertTrue("blob:app://gallery.gaiamobile.org/" in image.current_image_source)
        else:
            Wait(self.marionette).until(lambda m: gallery.empty_gallery_text == 'Use the Camera app to get started.')
            self.assertTrue(gallery.gallery_items_number == 0)
            self.assertEqual(gallery.empty_gallery_title, 'No photos or videos')
开发者ID:Anirudh0,项目名称:gaia,代码行数:18,代码来源:test_gallery_handle_invalid_file.py

示例15: TestCardsViewTwoApps

class TestCardsViewTwoApps(GaiaImageCompareTestCase):

    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        self.contacts = Contacts(self.marionette)
        self.contacts.launch()
        self.gallery = Gallery(self.marionette)
        self.gallery.launch(empty=True)

        # 10 seconds for the actual user using the app a bit, and going back to homescreen
        time.sleep(10)
        self.device.touch_home_button()

    def test_cards_view_kill_apps_with_two_apps(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

        # Pull up the cards view
        self.device.hold_home_button()
        self.cards_view.wait_for_cards_view()

        # Wait for first app ready
        self.cards_view.cards[1].wait_for_centered()
        self.take_screenshot(top_frame=True)

        # Close the current apps from the cards view
        self.cards_view.cards[1].close()
        self.cards_view.cards[0].wait_for_centered()
        self.take_screenshot(top_frame=True)
        self.cards_view.cards[0].close()
        self.cards_view.wait_for_cards_view_not_displayed()
        self.take_screenshot(top_frame=True)

        # If successfully killed, the apps should no longer appear in the cards view
        # and the "No recent apps" message should be displayed
        self.device.hold_home_button()
        self.cards_view.wait_for_no_card_displayed()
        self.take_screenshot(top_frame=True)
        self.assertEqual(len(self.cards_view.cards), 0)
        self.assertTrue(self.cards_view.is_no_card_displayed)
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:41,代码来源:test_cards_view_kill_apps_with_two_apps.py


注:本文中的gaiatest.apps.gallery.app.Gallery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。