summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/test_interface/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/test_multiple_find_package/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/test_platform_defs_include/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/test_use_modules_function/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp7
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp41
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp46
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp7
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/test.pro2
-rw-r--r--tests/auto/opengl/qglthreads/tst_qglthreads.cpp1
-rw-r--r--tests/auto/other/macgui/macgui.pro2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/qlineedit.pro1
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro1
-rw-r--r--tests/auto/widgets/widgets/qtextedit/qtextedit.pro2
15 files changed, 83 insertions, 38 deletions
diff --git a/tests/auto/cmake/test_interface/CMakeLists.txt b/tests/auto/cmake/test_interface/CMakeLists.txt
index a8af92da63..2af80ea448 100644
--- a/tests/auto/cmake/test_interface/CMakeLists.txt
+++ b/tests/auto/cmake/test_interface/CMakeLists.txt
@@ -8,6 +8,8 @@ find_package(Qt5Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+
add_executable(test_interface_exe WIN32 main.cpp mainwindow.cpp)
# No need to specify include directories, compile definitions, the PIC flag, or to
diff --git a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt
index c0fdfd6b9a..6b11c09e7b 100644
--- a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt
+++ b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt
@@ -9,5 +9,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
add_subdirectory(subdir1)
-add_executable(exe1 "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
-include_directories(${Qt5Core_INCLUDE_DIRS})
+add_executable(exe1 main.cpp)
+target_link_libraries(exe1 Qt5::Core)
diff --git a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt
index 0c7a113f50..dfcc35d735 100644
--- a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt
+++ b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt
@@ -2,4 +2,4 @@
find_package(Qt5Core REQUIRED)
add_executable(exe2 "${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp")
-include_directories(${Qt5Core_INCLUDE_DIRS})
+target_link_libraries(exe2 Qt5::Core)
diff --git a/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt b/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt
index 2b32a419e7..e2f72842f6 100644
--- a/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt
+++ b/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt
@@ -11,3 +11,4 @@ add_definitions(${Qt5Core_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
add_executable(myobject main.cpp)
+target_link_libraries(myobject Qt5::Core)
diff --git a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
index bfcdd9d1d7..be05c75054 100644
--- a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
+++ b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt
@@ -12,5 +12,7 @@ add_executable(three three.cpp)
find_package(Qt5Core)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+
qt5_use_modules(two Test)
qt5_use_modules(three Gui Test)
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 846f560214..bbca60a80e 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -1736,12 +1736,16 @@ void tst_QVariant::compareNumbers_data() const
QTest::newRow("float3") << qVariantFromValue(0.f) << qVariantFromValue(-1.f) << +1;
QTest::newRow("float4") << qVariantFromValue(-float(qInf())) << qVariantFromValue(0.f) << -1;
QTest::newRow("float5") << qVariantFromValue(0.f) << qVariantFromValue(-float(qInf())) << +1;
+ QTest::newRow("float6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(-float(qInf())) << 0;
+ QTest::newRow("float7") << qVariantFromValue(float(qInf())) << qVariantFromValue(float(qInf())) << 0;
QTest::newRow("double1") << qVariantFromValue(0.) << qVariantFromValue(0.) << 0;
QTest::newRow("double2") << qVariantFromValue(-1.) << qVariantFromValue(0.) << -1;
QTest::newRow("double3") << qVariantFromValue(0.) << qVariantFromValue(-1.) << +1;
QTest::newRow("double4") << qVariantFromValue(-qInf()) << qVariantFromValue(0.) << -1;
QTest::newRow("double5") << qVariantFromValue(0.) << qVariantFromValue(-qInf()) << +1;
+ QTest::newRow("double6") << qVariantFromValue(-double(qInf())) << qVariantFromValue(-qInf()) << 0;
+ QTest::newRow("double7") << qVariantFromValue(qInf()) << qVariantFromValue(qInf()) << 0;
// mixed comparisons
// fp + fp
@@ -1750,6 +1754,8 @@ void tst_QVariant::compareNumbers_data() const
QTest::newRow("float+double3") << qVariantFromValue(0.f) << qVariantFromValue(-1.) << +1;
QTest::newRow("float+double4") << qVariantFromValue(-float(qInf())) << qVariantFromValue(0.) << -1;
QTest::newRow("float+double5") << qVariantFromValue(0.f) << qVariantFromValue(-qInf()) << +1;
+ QTest::newRow("float+double6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(qInf()) << 0;
+ QTest::newRow("float+double7") << qVariantFromValue(float(qInf())) << qVariantFromValue(qInf()) << 0;
// fp + int
QTest::newRow("float+int1") << qVariantFromValue(0.f) << qVariantFromValue(0) << 0;
@@ -1760,6 +1766,7 @@ void tst_QVariant::compareNumbers_data() const
QTest::newRow("double+int3") << qVariantFromValue(0.) << qVariantFromValue(-1) << +1;
QTest::newRow("float+int4") << qVariantFromValue(1.5f) << qVariantFromValue(1) << +1;
QTest::newRow("double+int4") << qVariantFromValue(1.5) << qVariantFromValue(1) << +1;
+ QTest::newRow("double+int5") << qVariantFromValue(qInf()) << qVariantFromValue(1) << +1;
// fp + uint
QTest::newRow("float+uint1") << qVariantFromValue(0.f) << qVariantFromValue(0U) << 0;
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index 27988e5b5b..ba7586c3db 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -392,16 +392,37 @@ void tst_QDate::weekNumber_data()
QTest::addColumn<int>("month");
QTest::addColumn<int>("day");
- //next we fill it with data
- QTest::newRow( "data0" ) << 10 << 2002 << 2002 << 3 << 8;
- QTest::newRow( "data1" ) << 10 << 2002 << 2002 << 3 << 8;
- QTest::newRow( "data2" ) << 52 << 1999 << 2000 << 1 << 1;
- QTest::newRow( "data3" ) << 52 << 1999 << 1999 << 12 << 31;
- QTest::newRow( "data4" ) << 1 << 2001 << 2001 << 1 << 1;
- QTest::newRow( "data5" ) << 53 << 1998 << 1998 << 12 << 31;
- QTest::newRow( "data6" ) << 1 << 1985 << 1984 << 12 << 31;
- QTest::newRow( "data7" ) << 52 << 2006 << 2006 << 12 << 31;
- QTest::newRow( "data8" ) << 53 << 2004 << 2005 << 1 << 1;
+ enum { Thursday = 4 };
+ bool wasLastYearLong = false; // 1999 was not a long (53-week) year
+ bool isLongYear;
+
+ // full 400-year cycle for Jan 1, 4 and Dec 28, 31
+ for (int yr = 2000; yr < 2400; ++yr, wasLastYearLong = isLongYear) {
+ QByteArray yrstr = QByteArray::number(yr);
+ int wday = QDate(yr, 1, 1).dayOfWeek();
+
+ // the year is 53-week long if Jan 1 is Thursday or, if it's a leap year, a Wednesday
+ isLongYear = (wday == Thursday) || (QDate::isLeapYear(yr) && wday == Thursday - 1);
+
+ // Jan 4 is always on week 1
+ QTest::newRow(yrstr + "-01-04") << 1 << yr << yr << 1 << 4;
+
+ // Dec 28 is always on the last week
+ QTest::newRow(yrstr + "-12-28") << (52 + isLongYear) << yr << yr << 12 << 28;
+
+ // Jan 1 is on either on week 1 or on the last week of the previous year
+ QTest::newRow(yrstr + "-01-01")
+ << (wday <= Thursday ? 1 : 52 + wasLastYearLong)
+ << (wday <= Thursday ? yr : yr - 1)
+ << yr << 1 << 1;
+
+ // Dec 31 is either on the last week or week 1 of the next year
+ wday = QDate(yr, 12, 31).dayOfWeek();
+ QTest::newRow(yrstr + "-12-31")
+ << (wday >= Thursday ? 52 + isLongYear : 1)
+ << (wday >= Thursday ? yr : yr + 1)
+ << yr << 12 << 31;
+ }
}
void tst_QDate::weekNumber()
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 906129d1af..0088820b41 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -68,6 +68,7 @@ private slots:
void timeSpec();
void toTime_t_data();
void toTime_t();
+ void daylightSavingsTimeChange_data();
void daylightSavingsTimeChange();
void springForward_data();
void springForward();
@@ -1563,36 +1564,47 @@ void tst_QDateTime::toTime_t()
}
}
+void tst_QDateTime::daylightSavingsTimeChange_data()
+{
+ QTest::addColumn<QDate>("inDST");
+ QTest::addColumn<QDate>("outDST");
+ QTest::newRow("Autumn") << QDate(2006, 8, 1) << QDate(2006, 12, 1);
+ QTest::newRow("Spring") << QDate(2006, 5, 1) << QDate(2006, 2, 1);
+}
+
void tst_QDateTime::daylightSavingsTimeChange()
{
- // This is a regression test for an old bug where starting with a date in
- // DST and then moving to a date outside it (or vice-versa) caused 1-hour
- // jumps in time when addSecs() was called.
+ // This has grown from a regression test for an old bug where starting with
+ // a date in DST and then moving to a date outside it (or vice-versa) caused
+ // 1-hour jumps in time when addSecs() was called.
//
// The bug was caused by QDateTime knowing more than it lets show.
// Internally, if it knows, QDateTime stores a flag indicating if the time is
// DST or not. If it doesn't, it sets to "LocalUnknown". The problem happened
// because some functions did not reset the flag when moving in or out of DST.
- // WARNING: This test only works if there's a Daylight Savings Time change
- // in the current locale between 2006-11-06 and 2006-10-16
- // This is true for Central European Time
+ // WARNING: This only tests anything if there's a Daylight Savings Time change
+ // in the current locale between inDST and outDST.
+ // This is true for Central European Time and may be elsewhere.
- if (!europeanTimeZone)
- QSKIP("Not tested with timezone other than Central European (CET/CEST)");
+ QFETCH(QDate, inDST);
+ QFETCH(QDate, outDST);
- QDateTime dt = QDateTime(QDate(2006, 11, 6), QTime(0, 0, 0), Qt::LocalTime);
- dt.setDate(QDate(2006, 10, 16));
+ // First with simple construction
+ QDateTime dt = QDateTime(outDST, QTime(0, 0, 0), Qt::LocalTime);
+ int outDSTsecs = dt.toTime_t();
+
+ dt.setDate(inDST);
dt = dt.addSecs(1);
- QCOMPARE(dt.date(), QDate(2006, 10, 16));
- QCOMPARE(dt.time(), QTime(0, 0, 1));
+ QCOMPARE(dt, QDateTime(inDST, QTime(0, 0, 1)));
// now using fromTime_t
- dt = QDateTime::fromTime_t(1162767600); // 2006-11-06 00:00:00 +0100
- dt.setDate(QDate(2006, 10, 16));
- dt = dt.addSecs (1);
- QCOMPARE(dt.date(), QDate(2006, 10, 16));
- QCOMPARE(dt.time(), QTime(0, 0, 1));
+ dt = QDateTime::fromTime_t(outDSTsecs);
+ QCOMPARE(dt, QDateTime(outDST, QTime(0, 0, 0)));
+
+ dt.setDate(inDST);
+ dt = dt.addSecs(60);
+ QCOMPARE(dt, QDateTime(inDST, QTime(0, 1, 0)));
}
void tst_QDateTime::springForward_data()
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index aa17d71d60..7cd8c875ec 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -71,7 +71,6 @@ void tst_QDBusConnection::noConnection()
QVERIFY(con.callWithCallback(msg, &spy, SLOT(asyncReply)) == 0);
QDBusMessage reply = con.call(msg);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.type(), QDBusMessage::ErrorMessage);
QDBusReply<void> voidreply(reply);
@@ -153,7 +152,6 @@ void tst_QDBusConnection::send()
QDBusMessage reply = con.call(msg);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().count(), 1);
QCOMPARE(reply.arguments().at(0).typeName(), "QStringList");
QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService()));
@@ -173,7 +171,6 @@ void tst_QDBusConnection::sendWithGui()
QDBusMessage reply = con.call(msg, QDBus::BlockWithGui);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().count(), 1);
QCOMPARE(reply.arguments().at(0).typeName(), "QStringList");
QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService()));
@@ -843,7 +840,6 @@ void tst_QDBusConnection::callSelf()
QString(), "test3");
msg << 44;
reply = connection.call(msg);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.arguments().value(0).toInt(), 45);
}
@@ -911,7 +907,6 @@ void tst_QDBusConnection::callSelfByAnotherName()
QString(), "test0");
QDBusMessage reply = con.call(msg, QDBus::Block, 1000);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
}
@@ -927,7 +922,6 @@ void tst_QDBusConnection::multipleInterfacesInQObject()
QDBusMessage msg = QDBusMessage::createMethodCall(con.baseService(), "/p1",
"local.BaseObject", "anotherMethod");
QDBusMessage reply = con.call(msg, QDBus::Block);
- QCOMPARE(msg.serial(), reply.replySerial());
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
QCOMPARE(reply.arguments().count(), 0);
}
@@ -1208,7 +1202,6 @@ void tst_QDBusConnection::callVirtualObjectLocal()
QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello");
QDBusMessage reply = con.call(message, QDBus::Block, 5000);
- QCOMPARE(message.serial(), reply.replySerial());
QCOMPARE(obj.callCount, 1);
QCOMPARE(obj.lastMessage.service(), con.baseService());
QCOMPARE(obj.lastMessage.interface(), QString());
diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro
index f27c582de2..40bf9c8d8e 100644
--- a/tests/auto/gui/kernel/qclipboard/test/test.pro
+++ b/tests/auto/gui/kernel/qclipboard/test/test.pro
@@ -3,6 +3,8 @@ SOURCES += ../tst_qclipboard.cpp
TARGET = ../tst_qclipboard
QT += testlib
+osx: LIBS += -framework AppKit
+
win32 {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qclipboard
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
index 7b7064529f..1dafa2779c 100644
--- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
@@ -805,7 +805,6 @@ void tst_QGLThreads::painterOnFboInThread()
int main(int argc, char **argv)
{
- QApplication::setAttribute(Qt::AA_X11InitThreads);
QApplication app(argc, argv);
QTEST_DISABLE_KEYPAD_NAVIGATION \
diff --git a/tests/auto/other/macgui/macgui.pro b/tests/auto/other/macgui/macgui.pro
index b557806555..75e0d595cb 100644
--- a/tests/auto/other/macgui/macgui.pro
+++ b/tests/auto/other/macgui/macgui.pro
@@ -6,4 +6,6 @@ HEADERS += guitest.h
QT = core-private widgets-private testlib
+osx: LIBS += -framework ApplicationServices
+
requires(mac)
diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
index 715dcb9550..636208d67a 100644
--- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
+++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
@@ -3,3 +3,4 @@ TARGET = tst_qlineedit
QT += gui-private core-private widgets widgets-private testlib
SOURCES += tst_qlineedit.cpp
+osx: LIBS += -framework AppKit
diff --git a/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro b/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro
index e98bae2089..be4102ec75 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro
+++ b/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro
@@ -9,3 +9,4 @@ INCLUDEPATH += ../
HEADERS +=
SOURCES += tst_qplaintextedit.cpp
+osx: LIBS += -framework AppKit
diff --git a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro
index 6e0fff17d5..8b39ab59b7 100644
--- a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro
+++ b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro
@@ -4,3 +4,5 @@ TARGET = tst_qtextedit
QT += widgets widgets-private gui-private core-private testlib
SOURCES += tst_qtextedit.cpp
+
+osx: LIBS += -framework AppKit