MCPcopy Create free account
hub / github.com/TeXworks/texworks / ScreenCalibrationWidget_contextMenu

Method ScreenCalibrationWidget_contextMenu

unit-tests/UI_test.cpp:268–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268void TestUI::ScreenCalibrationWidget_contextMenu()
269{
270 MyScreenCalibrationWidget w;
271
272 w.setGeometry(0, 0, 300, 20);
273 w.show();
274 QCoreApplication::processEvents();
275
276 // Click inside the rulerRect
277 QVERIFY(w.contextMenu().isVisible() == false);
278 {
279 const QPoint local = w.rulerRect().center();
280 const QPoint global = w.mapToGlobal(local);
281 QContextMenuEvent cme(QContextMenuEvent::Mouse, local, global);
282 QCoreApplication::instance()->notify(&w, &cme);
283 }
284 QVERIFY(w.contextMenu().isVisible());
285 w.contextMenu().close();
286
287 // Click outside the rulerRect
288 QVERIFY(w.contextMenu().isVisible() == false);
289 {
290 const QPoint local = w.rulerRect().topLeft() - QPoint(1, 1);
291 const QPoint global = w.mapToGlobal(local);
292 QContextMenuEvent cme(QContextMenuEvent::Mouse, local, global);
293 QCoreApplication::instance()->notify(&w, &cme);
294 }
295 QVERIFY(w.contextMenu().isVisible() == false);
296
297 // Keypress ("outside the rulerRect")
298 QVERIFY(w.contextMenu().isVisible() == false);
299 {
300 const QPoint local = w.rulerRect().center() - QPoint(1, 1);
301 const QPoint global = w.mapToGlobal(local);
302 QContextMenuEvent cme(QContextMenuEvent::Keyboard, local, global);
303 QCoreApplication::instance()->notify(&w, &cme);
304 }
305 QVERIFY(w.contextMenu().isVisible());
306 w.contextMenu().close();
307}
308
309void TestUI::ClickableLable_ctor()
310{

Callers

nothing calls this directly

Calls 1

rulerRectMethod · 0.80

Tested by

no test coverage detected