Example #1
0
 def _show_popup_menu():
     taskbar.explorer_app.wait_cpu_usage_lower(threshold=5, timeout=self.tm)
     taskbar.RightClickSystemTrayIcon('MFCTrayDemo')
     menu = self.app.top_window().children()[0]
     res = isinstance(menu, ToolbarWrapper) and menu.is_visible()
     menu_window[0] = menu
     return res
Example #2
0
    def testClickVisibleIcon(self):
        """
        Test minimizing a sample app into the visible area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is disabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=True,
                debug_img="%s_01" % (self.id())
                )

        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # click in the visible area
        taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=self.tm)
        taskbar.RightClickSystemTrayIcon('MFCTrayDemo')

        # verify PopupWindow method
        menu_window = self.app.top_window_().Children()[0]
        WaitUntil(self.tm, _retry_interval, menu_window.IsVisible)
        menu_window.MenuBarClickInput("#2", self.app)
        popup_window = self.app.top_window_()
        hdl = self.dlg.PopupWindow()
        self.assertEquals(popup_window.handle, hdl)

        taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.Wait('active', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))