summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-12-16 15:21:35 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-16 16:38:33 +0100
commitb13150336174083962d90922761fd96f07e173b4 (patch)
tree1655e9009efba21b008d7d2f810aacbde3e2c2d8 /tests
parentff19ebcc2d9c9668af24fe8add9f70c160776367 (diff)
parent9bfe3ab71e5291445e66be96d6cd1f63934a2d83 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: configure configure.pri examples/widgets/painting/fontsampler/mainwindow.cpp examples/widgets/painting/fontsampler/mainwindow.h mkspecs/features/moc.prf src/corelib/global/qglobal.h src/gui/text/qtextdocument.cpp Change-Id: Ica65512e00871695190a14ccea5c275b0165f787
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_back_pointers.jpgbin0 -> 910 bytes
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_past_end.jpgbin0 -> 910 bytes
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_ifds.jpgbin0 -> 964 bytes
-rw-r--r--tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_tags.jpgbin0 -> 910 bytes
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp17
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp39
-rw-r--r--tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp63
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp25
-rw-r--r--tests/auto/tools/qmakelib/parsertest.cpp69
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp26
-rw-r--r--tests/manual/manual.pro1
11 files changed, 212 insertions, 28 deletions
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_back_pointers.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_back_pointers.jpg
new file mode 100644
index 0000000000..164d3080a3
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_back_pointers.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_past_end.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_past_end.jpg
new file mode 100644
index 0000000000..7e2451e6f9
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_past_end.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_ifds.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_ifds.jpg
new file mode 100644
index 0000000000..52c6a93f08
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_ifds.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_tags.jpg b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_tags.jpg
new file mode 100644
index 0000000000..6a080aada7
--- /dev/null
+++ b/tests/auto/gui/image/qimage/images/jpeg_exif_invalid_data_too_many_tags.jpg
Binary files differ
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 9b5477a06a..65ee4a2188 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -188,7 +188,8 @@ private slots:
void exifOrientation();
void exif_QTBUG45865();
- void exif_invalid_data_QTBUG46870();
+ void exifInvalidData_data();
+ void exifInvalidData();
void cleanupFunctions();
@@ -3025,10 +3026,20 @@ void tst_QImage::exif_QTBUG45865()
QCOMPARE(image.size(), QSize(5, 8));
}
-void tst_QImage::exif_invalid_data_QTBUG46870()
+void tst_QImage::exifInvalidData_data()
+{
+ QTest::addColumn<bool>("$never used");
+ QTest::newRow("QTBUG-46870");
+ QTest::newRow("back_pointers");
+ QTest::newRow("past_end");
+ QTest::newRow("too_many_ifds");
+ QTest::newRow("too_many_tags");
+}
+
+void tst_QImage::exifInvalidData()
{
QImage image;
- QVERIFY(image.load(m_prefix + "jpeg_exif_invalid_data_QTBUG-46870.jpg"));
+ QVERIFY(image.load(m_prefix + "jpeg_exif_invalid_data_" + QTest::currentDataTag() + ".jpg"));
QVERIFY(!image.isNull());
}
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index a3de9ee5b5..ec143896ab 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -195,6 +195,7 @@ public:
private slots:
void cleanup();
+ void qPointerUniqueId();
void touchDisabledByDefault();
void touchEventAcceptedByDefault();
void touchBeginPropagatesWhenIgnored();
@@ -226,6 +227,44 @@ void tst_QTouchEvent::cleanup()
QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
}
+void tst_QTouchEvent::qPointerUniqueId()
+{
+ QPointingDeviceUniqueId id1, id2;
+
+ QCOMPARE(id1.numericId(), Q_INT64_C(-1));
+ QVERIFY(!id1.isValid());
+
+ QVERIFY( id1 == id2);
+ QVERIFY(!(id1 != id2));
+
+ QSet<QPointingDeviceUniqueId> set; // compile test
+ set.insert(id1);
+ set.insert(id2);
+ QCOMPARE(set.size(), 1);
+
+
+ const auto id3 = QPointingDeviceUniqueId::fromNumericId(-1);
+ QCOMPARE(id3.numericId(), Q_INT64_C(-1));
+ QVERIFY(!id3.isValid());
+
+ QVERIFY( id1 == id3);
+ QVERIFY(!(id1 != id3));
+
+ set.insert(id3);
+ QCOMPARE(set.size(), 1);
+
+
+ const auto id4 = QPointingDeviceUniqueId::fromNumericId(4);
+ QCOMPARE(id4.numericId(), Q_INT64_C(4));
+ QVERIFY(id4.isValid());
+
+ QVERIFY( id1 != id4);
+ QVERIFY(!(id1 == id4));
+
+ set.insert(id4);
+ QCOMPARE(set.size(), 2);
+}
+
void tst_QTouchEvent::touchDisabledByDefault()
{
// QWidget
diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
index 419c781aab..364e435d3d 100644
--- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
@@ -46,6 +46,8 @@
# include <netinet/in.h>
#endif
+Q_DECLARE_METATYPE(QHostAddress::SpecialAddress)
+
class tst_QHostAddress : public QObject
{
Q_OBJECT
@@ -232,51 +234,55 @@ void tst_QHostAddress::setAddress_QString()
void tst_QHostAddress::specialAddresses_data()
{
QTest::addColumn<QString>("text");
- QTest::addColumn<int>("address");
+ QTest::addColumn<QHostAddress::SpecialAddress>("address");
QTest::addColumn<bool>("result");
- QTest::newRow("localhost_1") << QString("127.0.0.1") << (int)QHostAddress::LocalHost << true;
- QTest::newRow("localhost_2") << QString("127.0.0.2") << (int)QHostAddress::LocalHost << false;
- QTest::newRow("localhost_3") << QString("127.0.0.2") << (int)QHostAddress::LocalHostIPv6 << false;
+ QTest::newRow("localhost_1") << QString("127.0.0.1") << QHostAddress::LocalHost << true;
+ QTest::newRow("localhost_2") << QString("127.0.0.2") << QHostAddress::LocalHost << false;
+ QTest::newRow("localhost_3") << QString("127.0.0.2") << QHostAddress::LocalHostIPv6 << false;
- QTest::newRow("localhost_ipv6_4") << QString("::1") << (int)QHostAddress::LocalHostIPv6 << true;
- QTest::newRow("localhost_ipv6_5") << QString("::2") << (int)QHostAddress::LocalHostIPv6 << false;
- QTest::newRow("localhost_ipv6_6") << QString("::1") << (int)QHostAddress::LocalHost << false;
+ QTest::newRow("localhost_ipv6_4") << QString("::1") << QHostAddress::LocalHostIPv6 << true;
+ QTest::newRow("localhost_ipv6_5") << QString("::2") << QHostAddress::LocalHostIPv6 << false;
+ QTest::newRow("localhost_ipv6_6") << QString("::1") << QHostAddress::LocalHost << false;
- QTest::newRow("null_1") << QString("") << (int)QHostAddress::Null << true;
- QTest::newRow("null_2") << QString("bjarne") << (int)QHostAddress::Null << true;
+ QTest::newRow("null_1") << QString("") << QHostAddress::Null << true;
+ QTest::newRow("null_2") << QString("bjarne") << QHostAddress::Null << true;
- QTest::newRow("compare_from_null") << QString("") << (int)QHostAddress::Broadcast << false;
+ QTest::newRow("compare_from_null") << QString("") << QHostAddress::Broadcast << false;
- QTest::newRow("broadcast_1") << QString("255.255.255.255") << (int)QHostAddress::Any << false;
- QTest::newRow("broadcast_2") << QString("255.255.255.255") << (int)QHostAddress::Broadcast << true;
+ QTest::newRow("broadcast_1") << QString("255.255.255.255") << QHostAddress::Any << false;
+ QTest::newRow("broadcast_2") << QString("255.255.255.255") << QHostAddress::Broadcast << true;
- QTest::newRow("any_ipv6") << QString("::") << (int)QHostAddress::AnyIPv6 << true;
- QTest::newRow("any_ipv4") << QString("0.0.0.0") << (int)QHostAddress::AnyIPv4 << true;
+ QTest::newRow("any_ipv6") << QString("::") << QHostAddress::AnyIPv6 << true;
+ QTest::newRow("any_ipv4") << QString("0.0.0.0") << QHostAddress::AnyIPv4 << true;
- QTest::newRow("dual_not_ipv6") << QString("::") << (int)QHostAddress::Any << false;
- QTest::newRow("dual_not_ipv4") << QString("0.0.0.0") << (int)QHostAddress::Any << false;
+ QTest::newRow("dual_not_ipv6") << QString("::") << QHostAddress::Any << false;
+ QTest::newRow("dual_not_ipv4") << QString("0.0.0.0") << QHostAddress::Any << false;
}
void tst_QHostAddress::specialAddresses()
{
QFETCH(QString, text);
- QFETCH(int, address);
+ QFETCH(QHostAddress::SpecialAddress, address);
QFETCH(bool, result);
- QVERIFY((QHostAddress(text) == (QHostAddress::SpecialAddress)address) == result);
+ QCOMPARE(QHostAddress(text) == address, result);
//check special address equal to itself (QTBUG-22898), note two overloads of operator==
- QVERIFY(QHostAddress((QHostAddress::SpecialAddress)address) == QHostAddress((QHostAddress::SpecialAddress)address));
- QVERIFY(QHostAddress((QHostAddress::SpecialAddress)address) == (QHostAddress::SpecialAddress)address);
+ QVERIFY(QHostAddress(address) == QHostAddress(address));
+ QVERIFY(QHostAddress(address) == address);
+ QVERIFY(!(QHostAddress(address) != QHostAddress(address)));
+ QVERIFY(!(QHostAddress(address) != address));
+
+ {
+ QHostAddress ha;
+ ha.setAddress(address);
+ QVERIFY(ha == address);
+ }
QHostAddress setter;
setter.setAddress(text);
- if (result) {
- QVERIFY(setter == (QHostAddress::SpecialAddress) address);
- } else {
- QVERIFY(!((QHostAddress::SpecialAddress) address == setter));
- }
+ QCOMPARE(setter == address, result);
}
@@ -359,6 +365,11 @@ void tst_QHostAddress::isEqual()
QCOMPARE(second.isEqual(first, QHostAddress::ConversionModeFlag(flags)), result);
}
+QT_WARNING_PUSH
+#ifdef QT_WARNING_DISABLE_DEPRECATED
+QT_WARNING_DISABLE_DEPRECATED
+#endif
+
void tst_QHostAddress::assignment()
{
QHostAddress address;
@@ -379,6 +390,8 @@ void tst_QHostAddress::assignment()
#endif // !Q_OS_WINRT
}
+QT_WARNING_POP
+
void tst_QHostAddress::scopeId()
{
QHostAddress address("fe80::2e0:4cff:fefb:662a%eth0");
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index e3be294e5f..4e215b8570 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -633,6 +633,31 @@ void tst_qmakelib::addControlStructs()
<< ""
<< true;
+ QTest::newRow("bypassNesting()")
+ << "defineTest(func) {\n"
+ "LOCAL = 1\n"
+ "bypassNesting() {\n"
+ "OUT = 1\n"
+ "!isEmpty(GLOBAL): OUT1 = 1\n"
+ "!isEmpty(LOCAL): OUT2 = 1\n"
+ "}\n"
+ "}\n"
+ "GLOBAL = 1\n"
+ "func()"
+ << "GLOBAL = 1\nLOCAL = UNDEF\nOUT = 1\nOUT1 = 1\nOUT2 = UNDEF"
+ << ""
+ << true;
+
+ QTest::newRow("error() from bypassNesting()")
+ << "defineTest(func) {\n"
+ "bypassNesting() { error(error) }\n"
+ "}\n"
+ "func()\n"
+ "OKE = 1"
+ << "OKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
QTest::newRow("top-level return()")
<< "VAR = good\nreturn()\nVAR = bad"
<< "VAR = good"
diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp
index dc92f98f45..70f1be5fc3 100644
--- a/tests/auto/tools/qmakelib/parsertest.cpp
+++ b/tests/auto/tools/qmakelib/parsertest.cpp
@@ -1684,6 +1684,57 @@ void tst_qmakelib::addParseCustomFunctions()
/* 22 */ << H(TokTerminator))
<< ""
<< true;
+
+ QTest::newRow("bypassNesting()-{return}")
+ << "defineTest(test) { bypassNesting() { return(true) } }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(16)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokBypassNesting)
+ /* 15 */ /* block */ << I(10)
+ /* 17 */ << H(TokLine) << H(1)
+ /* 19 */ << H(TokLiteral | TokNewStr) << S(L"true")
+ /* 25 */ << H(TokReturn)
+ /* 26 */ << H(TokTerminator)
+ /* 27 */ << H(TokTerminator))
+ << ""
+ << true;
+
+ QTest::newRow("test-AND-bypassNesting()-{}")
+ << "defineTest(test) { test: bypassNesting() {} }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(17)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokHashLiteral) << HS(L"test")
+ /* 22 */ << H(TokCondition)
+ /* 23 */ << H(TokAnd)
+ /* 24 */ << H(TokBypassNesting)
+ /* 25 */ /* block */ << I(1)
+ /* 27 */ << H(TokTerminator)
+ /* 28 */ << H(TokTerminator))
+ << ""
+ << true;
+
+ QTest::newRow("test-OR-bypassNesting()-{}")
+ << "defineTest(test) { test| bypassNesting() {} }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(17)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokHashLiteral) << HS(L"test")
+ /* 22 */ << H(TokCondition)
+ /* 23 */ << H(TokOr)
+ /* 24 */ << H(TokBypassNesting)
+ /* 25 */ /* block */ << I(1)
+ /* 27 */ << H(TokTerminator)
+ /* 28 */ << H(TokTerminator))
+ << ""
+ << true;
}
void tst_qmakelib::addParseAbuse()
@@ -1736,6 +1787,24 @@ void tst_qmakelib::addParseAbuse()
<< "in:1: Unexpected NOT operator in front of function definition."
<< false;
+ QTest::newRow("outer-bypassNesting()-{}")
+ << "bypassNesting() {}"
+ << TS()
+ << "in:1: Unexpected bypassNesting()."
+ << false;
+
+ QTest::newRow("bypassNesting(arg)-{}")
+ << "defineTest(test) { bypassNesting(arg) {} }"
+ << TS()
+ << "in:1: bypassNesting() requires zero arguments."
+ << false;
+
+ QTest::newRow("NOT-bypassNesting()-{}")
+ << "defineTest(test) { !bypassNesting() {} }"
+ << TS()
+ << "in:1: Unexpected NOT operator in front of bypassNesting()."
+ << false;
+
QTest::newRow("AND-test")
<< ":test"
<< TS(
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 2d335c532a..434876eb3c 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -133,6 +133,7 @@ private slots:
void taskQTBUG53205_crashReparentNested();
#ifdef Q_OS_MACOS
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
+ void QTBUG_57404_existingMenuItemException();
#endif
void taskQTBUG55966_subMenuRemoved();
@@ -1581,6 +1582,31 @@ void tst_QMenuBar::taskQTBUG56275_reinsertMenuInParentlessQMenuBar()
QVERIFY(tst_qmenubar_taskQTBUG56275(&menubar));
}
+
+void tst_QMenuBar::QTBUG_57404_existingMenuItemException()
+{
+ QMainWindow mw1;
+ QMainWindow mw2;
+ mw1.show();
+ mw2.show();
+
+ QMenuBar *mb = new QMenuBar(&mw1);
+ mw1.setMenuBar(mb);
+ mb->show();
+ QMenu *editMenu = new QMenu(QLatin1String("Edit"), &mw1);
+ mb->addMenu(editMenu);
+ QAction *copyAction = editMenu->addAction("&Copy");
+ copyAction->setShortcut(QKeySequence("Ctrl+C"));
+ QTest::ignoreMessage(QtWarningMsg, "Menu item \"&Copy\" has unsupported role QPlatformMenuItem::MenuRole(NoRole)");
+ copyAction->setMenuRole(QAction::NoRole);
+
+ QVERIFY(QTest::qWaitForWindowExposed(&mw2));
+ QTest::qWait(100);
+ mw2.close();
+ mw1.activateWindow();
+ QTest::qWait(100);
+ // No crash, all fine. Ideally, there should be only one warning.
+}
#endif // Q_OS_MACOS
void tst_QMenuBar::taskQTBUG55966_subMenuRemoved()
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 2fe96c2f93..8367994509 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -1,4 +1,5 @@
TEMPLATE=subdirs
+QT_FOR_CONFIG += network-private gui-private
SUBDIRS = bearerex \
filetest \