| 422 | } |
| 423 | |
| 424 | void TestUtils::FullscreenManager() |
| 425 | { |
| 426 | { |
| 427 | ::UnitTest::FullscreenManager m(nullptr); |
| 428 | #if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) |
| 429 | QSignalSpy spy(&m, SIGNAL(fullscreenChanged(bool))); |
| 430 | #else |
| 431 | QSignalSpy spy(&m, &::UnitTest::FullscreenManager::fullscreenChanged); |
| 432 | #endif |
| 433 | QVERIFY(spy.isValid()); |
| 434 | QCOMPARE(m.isFullscreen(), false); |
| 435 | m.toggleFullscreen(); |
| 436 | QCOMPARE(m.isFullscreen(), false); |
| 437 | m.setFullscreen(); |
| 438 | QCOMPARE(m.isFullscreen(), false); |
| 439 | QCOMPARE(spy.count(), 0); |
| 440 | |
| 441 | QCOMPARE(m.shortcuts().count(), 0); |
| 442 | m.addShortcut(QKeySequence(Qt::Key_F), SLOT(update())); |
| 443 | QCOMPARE(m.shortcuts().count(), 0); |
| 444 | |
| 445 | const QPoint mousePos{0, 0}; |
| 446 | QMouseEvent e(QMouseEvent::Move, mousePos, mousePos, Qt::NoButton, Qt::NoButton, {}); |
| 447 | m.mouseMoveEvent(&e); |
| 448 | } |
| 449 | { |
| 450 | QMainWindow w; |
| 451 | ::UnitTest::FullscreenManager m(&w); |
| 452 | #if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) |
| 453 | QSignalSpy spy(&m, SIGNAL(fullscreenChanged(bool))); |
| 454 | #else |
| 455 | QSignalSpy spy(&m, &::UnitTest::FullscreenManager::fullscreenChanged); |
| 456 | #endif |
| 457 | QVERIFY(spy.isValid()); |
| 458 | |
| 459 | w.setAttribute(Qt::WA_TranslucentBackground); |
| 460 | w.setMenuBar(new QMenuBar); |
| 461 | w.setStatusBar(new QStatusBar); |
| 462 | QToolBar * tb = w.addToolBar(QString()); |
| 463 | |
| 464 | w.show(); |
| 465 | QCoreApplication::processEvents(); |
| 466 | // Ensure the window is properly shown/activated/polished |
| 467 | spy.wait(m.timeout()); |
| 468 | |
| 469 | QCOMPARE(m.isFullscreen(), false); |
| 470 | |
| 471 | if (!w.menuBar()->isNativeMenuBar()) { |
| 472 | QCOMPARE(w.menuBar()->isVisibleTo(&w), true); |
| 473 | } |
| 474 | QCOMPARE(w.statusBar()->isVisibleTo(&w), true); |
| 475 | QCOMPARE(tb->isVisibleTo(&w), true); |
| 476 | |
| 477 | m.toggleFullscreen(); |
| 478 | |
| 479 | QCOMPARE(m.isFullscreen(), true); |
| 480 | if (!w.menuBar()->isNativeMenuBar()) { |
| 481 | QCOMPARE(w.menuBar()->isVisibleTo(&w), false); |
nothing calls this directly
no test coverage detected