MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / simulateDrag

Method simulateDrag

test/tools_t.cpp:145–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void TestMapEditor::simulateDrag(const QPoint& start_pos, const QPoint& end_pos)
146{
147 QTest::mousePress(map_widget, Qt::LeftButton, {}, start_pos);
148
149 // NOTE: the implementation of QTest::mouseMove() does not seem to work (tries to set the real cursor position ...)
150 //QTest::mouseMove(map_widget, end_pos);
151 // Use manual workaround instead which sends an event directly:
152 QMouseEvent event(QEvent::MouseMove, end_pos, map_widget->mapToGlobal(end_pos), Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
153 QApplication::sendEvent(map_widget, &event);
154
155 QTest::mouseRelease(map_widget, Qt::LeftButton, {}, end_pos);
156}
157
158void TestMapEditor::simulateDrag(const QPointF& start_pos, const QPointF& end_pos)
159{

Callers 1

editToolMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected