示例#1
0
    def testPrefsXMLEditor(self):
        managerwin = self.app.topwin
        uiutils.drag(managerwin, 0, 200)
        detailswin = self._open_details_window(vmname="test-clone-simple")
        finish = detailswin.find("config-apply")
        xmleditor = detailswin.find("XML editor")

        detailswin.find("XML", "page tab").click()
        uiutils.drag(detailswin, 400, 400)
        warnlabel = detailswin.find_fuzzy("XML editing is disabled")
        uiutils.check(lambda: warnlabel.visible)
        origtext = xmleditor.text
        xmleditor.typeText("1234abcd")
        uiutils.check(lambda: xmleditor.text == origtext)

        managerwin.grabFocus()
        managerwin.click()
        managerwin.find("Edit", "menu").click()
        managerwin.find("Preferences", "menu item").click()
        prefswin = self.app.root.find_fuzzy("Preferences", "frame")
        prefswin.find_fuzzy("Enable XML").click()
        prefswin.find_fuzzy("Close", "push button").click()
        uiutils.check(lambda: prefswin.visible is False)

        managerwin.keyCombo("<alt>F4")
        detailswin.click()
        newtext = xmleditor.text.replace(">", "><title>FOOTITLE</title>", 1)
        xmleditor.set_text(newtext)
        finish.click()
        detailswin.find("Details", "page tab").click()
        uiutils.check(lambda:
                detailswin.find("Title:", "text").text == "FOOTITLE")
示例#2
0
    def testSystrayFake(self):
        self.app.open(keyfile="systray.ini",
                      extra_opts=["--test-options=fake-systray"],
                      window_name="Virtual Machine Manager")

        manager = self.app.topwin
        systray = self.app.root.find("vmm-fake-systray", check_active=False)
        uiutils.drag(manager, 1000, 1000)

        # Add a connection to trigger systray update
        uri = tests.utils.URIs.kvm
        manager.find("File", "menu").click()
        manager.find("Add Connection...", "menu item").click()
        win = self.app.root.find_fuzzy("Add Connection", "dialog")
        win.combo_select("Hypervisor", "Custom URI")
        win.find("uri-entry", "text").set_text(uri)
        win.find("Connect", "push button").click()

        # Hide the manager
        systray.click_title()
        systray.click()
        uiutils.check(lambda: not manager.showing)
        uiutils.check(lambda: self.app.is_running())

        systray.click(button=3)
        menu = self.app.root.find("vmm-systray-menu")

        def _get_conn_action(connstr, actionstr):
            if not menu.showing:
                systray.click(button=3)
            uiutils.check(lambda: menu.showing)
            connmenu = menu.find(connstr, "menu")
            connmenu.point()
            return connmenu.find(actionstr, "menu")

        def _check_conn_action(connstr, actionstr):
            item = _get_conn_action(connstr, actionstr)
            uiutils.check(lambda: item.showing)
            systray.click(button=3)
            uiutils.check(lambda: not menu.showing)

        def _do_conn_action(connstr, actionstr):
            item = _get_conn_action(connstr, actionstr)
            item.click()
            uiutils.check(lambda: not menu.showing)

        def _get_vm_action(connstr, vmname, action):
            vmenu = _get_conn_action(connstr, vmname)
            vmenu.point()
            return vmenu.find(action, "menu")

        def _check_vm_action(connstr, vmname, action):
            item = _get_vm_action(connstr, vmname, action)
            uiutils.check(lambda: item.showing)
            systray.click(button=3)
            uiutils.check(lambda: not menu.showing)

        def _do_vm_action(connstr, vmname, action):
            item = _get_vm_action(connstr, vmname, action)
            item.click()
            uiutils.check(lambda: not menu.showing)

        # Right click start a connection
        _check_conn_action("QEMU/KVM", "Disconnect")
        _do_conn_action("test default", "Connect")
        _check_conn_action("test default", "Disconnect")
        _do_conn_action("test testdriver", "Disconnect")
        _check_conn_action("test testdriver", "Connect")

        # Trigger VM change
        _do_vm_action("QEMU/KVM", "test-arm-kernel", "Pause")
        _check_vm_action("QEMU/KVM", "test-arm-kernel", "Resume")

        # Reshow the manager
        systray.click()
        uiutils.check(lambda: manager.showing)
        uiutils.check(lambda: self.app.is_running())

        # Close from the menu
        systray.click_title()
        systray.click(button=3)
        menu = self.app.root.find("vmm-systray-menu")
        menu.find("Quit", "menu item").click()

        uiutils.check(lambda: not self.app.is_running())
示例#3
0
 def _drag(win):
     """
     Drag a window so it's not obscuring the manager window
     """
     uiutils.drag(win, 1000, 1000)