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


Python Pointer.release方法代码示例

本文整理汇总了Python中autopilot.input.Pointer.release方法的典型用法代码示例。如果您正苦于以下问题:Python Pointer.release方法的具体用法?Python Pointer.release怎么用?Python Pointer.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autopilot.input.Pointer的用法示例。


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

示例1: _long_press_key

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import release [as 别名]
 def _long_press_key(self, key_rect, pointer=None):
     if pointer is None:
         pointer = Pointer(Touch.create())
     pointer.move(
         key_rect.x + key_rect.w / 2.0, key_rect.y + key_rect.h / 2.0)
     pointer.press()
     sleep(0.5)
     pointer.release()
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:10,代码来源:keyboard.py

示例2: UbuntuTouchAppTestCase

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import release [as 别名]
class UbuntuTouchAppTestCase(AutopilotTestCase):
    """A common test case class that provides several useful methods for the tests."""

    if model() == 'Desktop':
        scenarios = [
        ('with mouse', dict(input_device_class=Mouse))
        ]
    else:
        scenarios = [
        ('with touch', dict(input_device_class=Touch))
        ]

    @property
    def main_window(self):
        return MainWindow(self.app)


    def setUp(self):
        self.pointing_device = Pointer(self.input_device_class.create())
        super(UbuntuTouchAppTestCase, self).setUp()
        self.launch_test_qml()


    def launch_test_qml(self):
        # If the test class has defined a 'test_qml' class attribute then we
        # write it to disk and launch it inside the QML Scene. If not, then we
        # silently do nothing (presumably the test has something else planned).
        arch = subprocess.check_output(["dpkg-architecture",
        "-qDEB_HOST_MULTIARCH"]).strip()
        if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring):
            qml_path = mktemp(suffix='.qml')
            open(qml_path, 'w').write(self.test_qml)
            self.addCleanup(remove, qml_path)

            self.app = self.launch_test_application(
                "/usr/lib/" + arch + "/qt5/bin/qmlscene",
                "-I", get_module_include_path(),
                qml_path,
                app_type='qt')

        if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring):
            qml_path = self.test_qml_file
            self.app = self.launch_test_application(
                "/usr/lib/" + arch + "/qt5/bin/qmlscene",
                "-I", get_module_include_path(),
                qml_path,
                app_type='qt')

        self.assertThat(self.get_qml_view().visible, Eventually(Equals(True)))


    def get_qml_view(self):
        """Get the main QML view"""

        return self.app.select_single("QQuickView")

    def get_mainview(self):
        """Get the QML MainView"""

        mainView = self.app.select_single("MainView")
        self.assertThat(mainView, Not(Is(None)))
        return mainView


    def get_object(self,objectName):
        """Get a object based on the objectName"""

        obj = self.app.select_single(objectName=objectName)
        self.assertThat(obj, Not(Is(None)))
        return obj


    def mouse_click(self,objectName):
        """Move mouse on top of the object and click on it"""

        obj = self.get_object(objectName)
        self.pointing_device.move_to_object(obj)
        self.pointing_device.click()


    def mouse_press(self,objectName):
        """Move mouse on top of the object and press mouse button (without releasing it)"""

        obj = self.get_object(objectName)
        self.pointing_device.move_to_object(obj)
        self.pointing_device.press()


    def mouse_release(self):
        """Release mouse button"""

        self.pointing_device.release()     


    def type_string(self, string):
        """Type a string with keyboard"""

        self.keyboard.type(string)


#.........这里部分代码省略.........
开发者ID:Anne017,项目名称:OVU,代码行数:103,代码来源:__init__.py

示例3: SaucyBaconTestCase

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import release [as 别名]
class SaucyBaconTestCase(AutopilotTestCase):
    """A common test case class that provides several useful methods for the tests."""

    if model() == 'Desktop':
        scenarios = [
        ('with mouse', dict(input_device_class=Mouse))
        ]
    else:
        scenarios = [
        ('with touch', dict(input_device_class=Touch))
        ]
    
    local_location = get_qml_location() + "/saucybacon.qml"

    @property
    def main_window(self):
        return MainWindow(self.app)

    def setUp(self):
        self.pointing_device = Pointer(self.input_device_class.create())
        super(SaucyBaconTestCase, self).setUp()
        
        print self.local_location
        print get_module_include_path()
        if os.path.exists(self.local_location):
            self.launch_test_local()
        elif os.path.exists('/usr/share/saucybacon/app/saucybacon.qml'):
            self.launch_test_installed()
        else:
            self.launch_test_click()

    def launch_test_local(self):
        self.app = self.launch_test_application(
            "qmlscene",
            self.local_location,
            "-I",
            get_module_include_path(),
            app_type='qt',
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)

    def launch_test_installed(self):
        self.app = self.launch_test_application(
            "qmlscene",
            "/usr/share/postino/postino.qml",
            "--desktop_file_hint=/usr/share/applications/saucybacon.desktop",
            app_type='qt',
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)

    def launch_test_click(self):
        self.app = self.launch_click_package(
            'com.ubuntu.developers.gcollura.saucybacon',
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)


    def get_qml_view(self):
        """Get the main QML view"""

        return self.app.select_single("QQuickView")

    def get_mainview(self):
        """Get the QML MainView"""

        mainView = self.app.select_single("MainView")
        self.assertThat(mainView, Not(Is(None)))
        return mainView


    def get_object(self,objectName):
        """Get a object based on the objectName"""

        obj = self.app.select_single(objectName=objectName)
        self.assertThat(obj, Not(Is(None)))
        return obj


    def mouse_click(self,objectName):
        """Move mouse on top of the object and click on it"""

        obj = self.get_object(objectName)
        self.pointing_device.move_to_object(obj)
        self.pointing_device.click()


    def mouse_press(self,objectName):
        """Move mouse on top of the object and press mouse button (without releasing it)"""

        obj = self.get_object(objectName)
        self.pointing_device.move_to_object(obj)
        self.pointing_device.press()


    def mouse_release(self):
        """Release mouse button"""

        self.pointing_device.release()     


    def type_string(self, string):
        """Type a string with keyboard"""

#.........这里部分代码省略.........
开发者ID:gcollura,项目名称:saucybacon,代码行数:103,代码来源:__init__.py


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