Changeset View
Changeset View
Standalone View
Standalone View
Tests/kstars_ui/kstars_ui_tests.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 88 | { | |||
---|---|---|---|---|---|
93 | QCOMPARE(KStars::Instance()->data()->clock()->isActive(), m_InitialConditions.clockRunning); | 93 | QCOMPARE(KStars::Instance()->data()->clock()->isActive(), m_InitialConditions.clockRunning); | ||
94 | 94 | | |||
95 | QEXPECT_FAIL("", "Initial KStars clock is set from system local time, not geolocation, and is untestable for now.", Continue); | 95 | QEXPECT_FAIL("", "Initial KStars clock is set from system local time, not geolocation, and is untestable for now.", Continue); | ||
96 | QCOMPARE(KStars::Instance()->data()->clock()->utc().toString(), m_InitialConditions.dateTime.toString()); | 96 | QCOMPARE(KStars::Instance()->data()->clock()->utc().toString(), m_InitialConditions.dateTime.toString()); | ||
97 | 97 | | |||
98 | QEXPECT_FAIL("", "Precision of KStars local time conversion to local time does not allow strict millisecond comparison.", Continue); | 98 | QEXPECT_FAIL("", "Precision of KStars local time conversion to local time does not allow strict millisecond comparison.", Continue); | ||
99 | QCOMPARE(KStars::Instance()->data()->clock()->utc().toLocalTime(), m_InitialConditions.dateTime); | 99 | QCOMPARE(KStars::Instance()->data()->clock()->utc().toLocalTime(), m_InitialConditions.dateTime); | ||
100 | 100 | | |||
101 | #if QT_VERSION >= 0x050800 | ||||
101 | // However comparison down to nearest second is expected to be OK | 102 | // However comparison down to nearest second is expected to be OK | ||
102 | QCOMPARE(llround(KStars::Instance()->data()->clock()->utc().toLocalTime().toMSecsSinceEpoch()/1000.0), m_InitialConditions.dateTime.toSecsSinceEpoch()); | 103 | QCOMPARE(llround(KStars::Instance()->data()->clock()->utc().toLocalTime().toMSecsSinceEpoch()/1000.0), m_InitialConditions.dateTime.toSecsSinceEpoch()); | ||
104 | #endif | ||||
103 | } | 105 | } | ||
104 | 106 | | |||
105 | // We want to launch the application before running our tests | 107 | // We want to launch the application before running our tests | ||
106 | // Thus we want to explicitly call QApplication::exec(), and run our tests in parallel of the event loop | 108 | // Thus we want to explicitly call QApplication::exec(), and run our tests in parallel of the event loop | ||
107 | // We then reimplement QTEST_MAIN(KStarsUiTests); | 109 | // We then reimplement QTEST_MAIN(KStarsUiTests); | ||
108 | // The same will have to be done when interacting with a modal dialog: exec() in main thread, tests in timer-based thread | 110 | // The same will have to be done when interacting with a modal dialog: exec() in main thread, tests in timer-based thread | ||
109 | 111 | | |||
110 | QT_BEGIN_NAMESPACE | 112 | QT_BEGIN_NAMESPACE | ||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |