summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-10 18:27:48 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-10 18:27:49 +0100
commit7917dfbf1c54150d0ca3a79285767c22e6f9d770 (patch)
treea05973334097df480afe32d07db42f381b460e74 /tests
parentb9362903b339e57362a7a3296904504521d0e26f (diff)
parentb088e4827f427189334e8a1c5b4f2b8b0b713fc2 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp6
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp44
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp5
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp4
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp7
6 files changed, 50 insertions, 22 deletions
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index 55a2bc7882..529069552b 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -259,14 +259,14 @@ void tst_QPauseAnimation::pauseResume()
animation.pause();
QVERIFY(animation.state() == QAbstractAnimation::Paused);
animation.start();
- QTest::qWait(300);
- QVERIFY(animation.state() == QAbstractAnimation::Stopped);
+ QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped);
#ifdef Q_OS_WIN
if (animation.m_updateCurrentTimeCount != 3)
QEXPECT_FAIL("", winTimerError, Abort);
#endif
- QCOMPARE(animation.m_updateCurrentTimeCount, 3);
+ QVERIFY2(animation.m_updateCurrentTimeCount >= 3, qPrintable(
+ QString::fromLatin1("animation.m_updateCurrentTimeCount = %1").arg(animation.m_updateCurrentTimeCount)));
}
void tst_QPauseAnimation::sequentialPauseGroup()
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 7d51696fe3..0e7ac54a86 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -64,6 +64,7 @@ public:
static QString str( int y, int month, int d, int h, int min, int s );
static QDateTime dt( const QString& str );
public slots:
+ void initTestCase();
void init();
private slots:
void ctor();
@@ -153,6 +154,7 @@ private slots:
void invalid() const;
private:
+ enum { LocalTimeIsUtc = 0, LocalTimeAheadOfUtc = 1, LocalTimeBehindUtc = -1} localTimeType;
bool europeanTimeZone;
QDate defDate() const { return QDate(1900, 1, 1); }
QTime defTime() const { return QTime(0, 0, 0); }
@@ -172,6 +174,42 @@ tst_QDateTime::tst_QDateTime()
uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
+
+ QDateTime dt1 = QDateTime::fromTime_t(0);
+ QDateTime dt2 = QDateTime::fromTime_t(181 * 86400); // six months later, Jul 1
+ if (dt1.date().year() < 1970 || dt2.date().month() < 7) {
+ localTimeType = LocalTimeBehindUtc;
+ } else if (dt1.time().hour() > 0 || dt1.date().day() > 1) {
+ localTimeType = LocalTimeAheadOfUtc;
+ } else if (dt2.time().hour() > 0 || dt2.date().day() > 1) {
+ localTimeType = LocalTimeAheadOfUtc;
+ } else {
+ localTimeType = LocalTimeIsUtc;
+ }
+}
+
+void tst_QDateTime::initTestCase()
+{
+ // Never construct a message like this in an i18n context...
+ const char *typemsg1, *typemsg2 = "and therefore not";
+ switch (localTimeType) {
+ case LocalTimeIsUtc:
+ typemsg1 = "exactly";
+ break;
+ case LocalTimeBehindUtc:
+ typemsg1 = "behind";
+ break;
+ case LocalTimeAheadOfUtc:
+ typemsg1 = "ahead of";
+ typemsg2 = europeanTimeZone ? "and is" : "but isn't";
+ break;
+ }
+
+ qDebug() << "Current local time detected to be"
+ << typemsg1
+ << "UTC"
+ << typemsg2
+ << "the Central European timezone";
}
void tst_QDateTime::init()
@@ -613,8 +651,10 @@ void tst_QDateTime::fromMSecsSinceEpoch()
QDateTime dtUtc = QDateTime::fromMSecsSinceEpoch(msecs, Qt::UTC);
QDateTime dtOffset = QDateTime::fromMSecsSinceEpoch(msecs, Qt::OffsetFromUTC, 60*60);
- // LocalTime will overflow for max
- if (msecs != std::numeric_limits<qint64>::max())
+ // LocalTime will overflow for min or max, depending on whether you're
+ // East or West of Greenwich. The test passes at GMT.
+ if (localTimeType == LocalTimeIsUtc
+ || msecs != std::numeric_limits<qint64>::max() * localTimeType)
QCOMPARE(dtLocal, utc);
QCOMPARE(dtUtc, utc);
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 19fcb6ea9f..bd7bd3a464 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -606,11 +606,6 @@ void tst_QKeySequence::parseString()
QFETCH( QString, strSequence );
QFETCH( QKeySequence, keycode );
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("Win+A", "QTBUG-24406 - This test fails on OSX", Abort);
- QEXPECT_FAIL("Simon+G", "QTBUG-24406 - This test fails on OSX", Abort);
-#endif
-
QCOMPARE( QKeySequence(strSequence).toString(), keycode.toString() );
QVERIFY( QKeySequence(strSequence) == keycode );
}
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 38c92c7610..1ec1d88802 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -1380,12 +1380,13 @@ void tst_QGL::glWidgetRenderPixmap()
{
RenderPixmapWidget *w = new RenderPixmapWidget;
- QPixmap pm = w->renderPixmap(100, 100, false);
+ QSize pmSize = QSize(100, 100);
+ QPixmap pm = w->renderPixmap(pmSize.width(), pmSize.height(), false);
delete w;
QImage fb = pm.toImage().convertToFormat(QImage::Format_RGB32);
- QImage reference(fb.size(), QImage::Format_RGB32);
+ QImage reference(pmSize, QImage::Format_RGB32);
reference.fill(0xffff0000);
QFUZZY_COMPARE_IMAGES(fb, reference);
@@ -2011,6 +2012,7 @@ void tst_QGL::textureCleanup()
QGLWidget w;
w.resize(200,200);
w.show();
+ QTest::qWaitForWindowExposed(&w);
w.makeCurrent();
// Test pixmaps which have been loaded via QPixmapCache are removed from the texture cache
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 9e181c0676..f7dff7bc57 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -1019,10 +1019,6 @@ private:
void tst_QMenu::QTBUG_10735_crashWithDialog()
{
-#ifdef Q_OS_MAC
- QSKIP("Test currently hangs on Mac OS X, see QTBUG-23677");
-#endif
-
MyMenu menu;
QTimer::singleShot(1000, &menu, SLOT(activateLastAction()));
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 75c826c4cc..d336d00b3e 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -566,7 +566,7 @@ void tst_QPushButton::sizeHint_data()
QTest::newRow("gtk") << QString::fromLatin1("gtk");
#endif
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- QTest::newRow("mac") << QString::fromLatin1("mac");
+ QTest::newRow("macintosh") << QString::fromLatin1("macintosh");
#endif
#if !defined(QT_NO_STYLE_FUSION)
QTest::newRow("fusion") << QString::fromLatin1("fusion");
@@ -589,11 +589,6 @@ void tst_QPushButton::sizeHint()
{
QFETCH(QString, stylename);
-#ifdef Q_OS_MAC
- if (stylename == "mac")
- QSKIP("QStyleFactory cannot create the Mac style, see QTBUG-23680");
-#endif
-
QStyle *style = QStyleFactory::create(stylename);
if (!style)
QFAIL(qPrintable(QString::fromLatin1("Cannot create style: %1").arg(stylename)));