Beispiel #1
0
    def mouseMove(widget, pos=None, delay=-1):
        """Simulate moving the mouse.

        See QTest.mouseMove for details.
        """
        pos = qt.QPoint(pos[0], pos[1]) if pos is not None else qt.QPoint()
        QTest.mouseMove(widget, pos, delay)
Beispiel #2
0
    def mouseMove(self, widget, pos=None, delay=-1):
        """Simulate moving the mouse.

        See QTest.mouseMove for details.
        """
        pos = qt.QPoint(pos[0], pos[1]) if pos is not None else qt.QPoint()
        QTest.mouseMove(widget, pos, delay)
        self.qWait(20)
Beispiel #3
0
    def test_change_order_part_state(self):
        order = self._make_order()

        order_part = self._order_part_dao.make(order)
        order_part.description = u"Part 2"
        order_part.position = 2
        self._order_part_dao.save(order_part)

        order_part = self._order_part_dao.make(order)
        order_part.description = u"Part 3"
        order_part.position = 3
        self._order_part_dao.save(order_part)

        self._order_dao.change_order_state(
            order.order_id, OrderStatusType.order_ready_for_production)

        # self.order_overview_widget.month_today()
        self.order_overview_widget.refresh_action()
        self.order_overview_widget.retake_focus()
        # self.app.exec_()

        # Select the first order part (we assume they are properly ordered)
        v = self.order_overview_widget.current_orders_overview.table_view
        v.setCurrentIndex(v.model().index(0, 0))
        QTest.mouseMove(v)

        # QTest.mouseClick(self.order_overview_widget.current_orders_overview.table_view,
        #                  Qt.RightButton, delay=500)

        # self.order_overview_widget.current_orders_overview.popup_parts()

        timer = QTimer()
        timer.timeout.connect(self._click_context_menu)
        timer.setSingleShot(True)
        timer.start(1000)

        # I can't have the menu to popup using museClicks, so I
        # do it this way. FIXME Taht's not right because nothing prooves
        # that my context menu is shown on mouse clicks...
        self.app.sendEvent(
            self.order_overview_widget.current_orders_overview.table_view,
            QContextMenuEvent(QContextMenuEvent.Keyboard, QPoint(10, 10)))

        # self.app.exec_()

        order = self.order_dao.find_by_id(order.order_id)
        self.assertEqual(OrderPartStateType.aborted, order.parts[0].state)
        self.assertEqual(OrderPartStateType.ready_for_production,
                         order.parts[1].state)
        self.assertEqual(OrderPartStateType.ready_for_production,
                         order.parts[2].state)
    def tearDown(self):
        QTest.mouseMove(self.dialog,
                        delay=2000)  # Emulates waiting, can be removed

        self.dialog.close()