summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro1
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp40
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro1
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp41
-rw-r--r--tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro1
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp101
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test50
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+osx/test40
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+mac/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+osx/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc114
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp8
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp6
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp24
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp7
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp62
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp53
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp426
-rw-r--r--tests/auto/corelib/serialization/json/tst_qtjson.cpp78
-rw-r--r--tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp15
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp2
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp76
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp42
-rw-r--r--tests/auto/corelib/text/qstringref/tst_qstringref.cpp13
-rw-r--r--tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp17
-rw-r--r--tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp6
-rw-r--r--tests/auto/corelib/thread/qfuture/qfuture.pro1
-rw-r--r--tests/auto/corelib/thread/qresultstore/qresultstore.pro1
-rw-r--r--tests/auto/corelib/tools/collections/collections.pro1
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp64
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro2
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp5
-rw-r--r--tests/auto/corelib/tools/qarraydata/simplevector.h53
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp634
-rw-r--r--tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp7
-rw-r--r--tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp61
-rw-r--r--tests/auto/corelib/tools/qlist/.gitignore1
-rw-r--r--tests/auto/corelib/tools/qlist/qlist.pro6
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp2115
-rw-r--r--tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp82
-rw-r--r--tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp2
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp2
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp425
-rw-r--r--tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/tools.pro6
-rw-r--r--tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp11
-rw-r--r--tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp2
-rw-r--r--tests/auto/gui/image/qpicture/tst_qpicture.cpp31
-rw-r--r--tests/auto/gui/kernel/kernel.pro13
-rw-r--r--tests/auto/gui/kernel/qguiaction/.gitignore (renamed from tests/auto/widgets/kernel/qaction/.gitignore)0
-rw-r--r--tests/auto/gui/kernel/qguiaction/qguiaction.pro4
-rw-r--r--tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp210
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/.gitignore1
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro4
-rw-r--r--tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp235
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp26
-rw-r--r--tests/auto/gui/kernel/qguishortcut/qguishortcut.pro4
-rw-r--r--tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp82
-rw-r--r--tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp6
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp37
-rw-r--r--tests/auto/network/access/access.pro1
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp7
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/auto/network/access/spdy/BLACKLIST7
-rw-r--r--tests/auto/network/access/spdy/spdy.pro7
-rw-r--r--tests/auto/network/access/spdy/tst_spdy.cpp693
-rw-r--r--tests/auto/network/ssl/qdtls/tst_qdtls.cpp1
-rw-r--r--tests/auto/network/ssl/qocsp/tst_qocsp.cpp1
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp177
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp4
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp18
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp6
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp8
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp5
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.lightxml2
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.tap2
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.teamcity2
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.txt2
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.xml2
-rw-r--r--tests/auto/testlib/selftests/expected_signaldumper.xunitxml4
-rw-r--r--tests/auto/tools/moc/allmocs_baseline_in.json2145
-rw-r--r--tests/auto/tools/moc/moc.pro2
-rw-r--r--tests/auto/tools/moc/task189996.h47
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp31
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp7
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp6
-rw-r--r--tests/auto/widgets/kernel/kernel.pro11
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp160
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp192
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp20
-rw-r--r--tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp22
-rw-r--r--tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp8
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp6
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp16
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp30
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp9
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp12
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp14
-rw-r--r--tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp5
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp11
-rw-r--r--tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp4
-rw-r--r--tests/auto/widgets/widgets/widgets.pro3
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp8
117 files changed, 2480 insertions, 6541 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 9eb741edac..c9d1da8649 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,5 +1,9 @@
TEMPLATE = subdirs
+# Tests with developer-build started failing on qemu-armv7/armv8 after commit
+# b88acae7a8e773c307e44f84da037d01d19e60f7 in qt5.
+boot2qt:qtConfig(private_tests): return()
+
SUBDIRS += \
corelib \
dbus \
diff --git a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
index 15345d40db..b372923310 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
+++ b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
@@ -2,5 +2,4 @@ CONFIG += testcase
TARGET = tst_qtconcurrentfilter
QT = core testlib concurrent
SOURCES = tst_qtconcurrentfilter.cpp
-DEFINES += QT_STRICT_ITERATORS
DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index 84ebd46886..8c4e1c16f3 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -714,16 +714,17 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6);
}
+ auto push_back = static_cast<void (QVector<int>::*)(const int &)>(&QVector<int>::push_back);
// functor-member
{
- QList<int> list2 = QtConcurrent::filteredReduced(list, KeepEvenIntegers(), &QList<int>::push_back, QtConcurrent::OrderedReduce);
+ QList<int> list2 = QtConcurrent::filteredReduced(list, KeepEvenIntegers(), push_back, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
QList<int> list2 = QtConcurrent::filteredReduced(list.begin(),
list.end(),
KeepEvenIntegers(),
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
@@ -731,19 +732,19 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<int> list2 = QtConcurrent::filteredReduced(list.constBegin(),
list.constEnd(),
KeepEvenIntegers(),
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
- QList<int> list2 = QtConcurrent::blockingFilteredReduced(list, KeepEvenIntegers(), &QList<int>::push_back, QtConcurrent::OrderedReduce);
+ QList<int> list2 = QtConcurrent::blockingFilteredReduced(list, KeepEvenIntegers(), push_back, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
QList<int> list2 = QtConcurrent::blockingFilteredReduced(list.begin(),
list.end(),
KeepEvenIntegers(),
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
@@ -751,7 +752,7 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<int> list2 = QtConcurrent::blockingFilteredReduced(list.constBegin(),
list.constEnd(),
KeepEvenIntegers(),
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
@@ -805,12 +806,15 @@ void tst_QtConcurrentFilter::filteredReduced()
}
// member-member
+
+ auto push_back_number = static_cast<void (QVector<Number>::*)(const Number &)>(&QVector<Number>::push_back);
+
{
QList<Number> numbers;
numbers << 1 << 2 << 3 << 4;
QList<Number> list2 = QtConcurrent::filteredReduced(numbers,
&Number::isEven,
- &QList<Number>::push_back, QtConcurrent::OrderedReduce);
+ push_back_number, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
{
@@ -819,7 +823,7 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<Number> list2 = QtConcurrent::filteredReduced(numbers.begin(),
numbers.end(),
&Number::isEven,
- &QList<Number>::push_back,
+ push_back_number,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
@@ -829,7 +833,7 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<Number> list2 = QtConcurrent::filteredReduced(numbers.constBegin(),
numbers.constEnd(),
&Number::isEven,
- &QList<Number>::push_back,
+ push_back_number,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
@@ -838,7 +842,7 @@ void tst_QtConcurrentFilter::filteredReduced()
numbers << 1 << 2 << 3 << 4;
QList<Number> list2 = QtConcurrent::blockingFilteredReduced(numbers,
&Number::isEven,
- &QList<Number>::push_back, QtConcurrent::OrderedReduce);
+ push_back_number, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
{
@@ -847,7 +851,7 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<Number> list2 = QtConcurrent::blockingFilteredReduced(numbers.begin(),
numbers.end(),
&Number::isEven,
- &QList<Number>::push_back,
+ push_back_number,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
@@ -857,21 +861,21 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<Number> list2 = QtConcurrent::blockingFilteredReduced(numbers.constBegin(),
numbers.constEnd(),
&Number::isEven,
- &QList<Number>::push_back,
+ push_back_number,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
// function-member
{
- QList<int> list2 = QtConcurrent::filteredReduced(list, keepEvenIntegers, &QList<int>::push_back, QtConcurrent::OrderedReduce);
+ QList<int> list2 = QtConcurrent::filteredReduced(list, keepEvenIntegers, push_back, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
QList<int> list2 = QtConcurrent::filteredReduced(list.begin(),
list.end(),
keepEvenIntegers,
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
@@ -879,19 +883,19 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<int> list2 = QtConcurrent::filteredReduced(list.constBegin(),
list.constEnd(),
keepEvenIntegers,
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
- QList<int> list2 = QtConcurrent::blockingFilteredReduced(list, keepEvenIntegers, &QList<int>::push_back, QtConcurrent::OrderedReduce);
+ QList<int> list2 = QtConcurrent::blockingFilteredReduced(list, keepEvenIntegers, push_back, QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
{
QList<int> list2 = QtConcurrent::blockingFilteredReduced(list.begin(),
list.end(),
keepEvenIntegers,
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
@@ -899,7 +903,7 @@ void tst_QtConcurrentFilter::filteredReduced()
QList<int> list2 = QtConcurrent::blockingFilteredReduced(list.constBegin(),
list.constEnd(),
keepEvenIntegers,
- &QList<int>::push_back,
+ push_back,
QtConcurrent::OrderedReduce);
QCOMPARE(list2, QList<int>() << 2 << 4);
}
diff --git a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
index 717d103e44..170881177d 100644
--- a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
+++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
@@ -2,7 +2,6 @@ CONFIG += testcase
TARGET = tst_qtconcurrentmap
QT = core testlib concurrent
SOURCES = tst_qtconcurrentmap.cpp
-DEFINES += QT_STRICT_ITERATORS
DEFINES -= QT_NO_LINKED_LIST
# Force C++17 if available
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 383de0b2ce..d9cbae1ac2 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -1381,11 +1381,13 @@ void tst_QtConcurrentMap::mappedReduced()
QCOMPARE(sum3, 14);
}
+ auto push_back = static_cast<void (QVector<int>::*)(const int &)>(&QVector<int>::push_back);
+
// functor-member
{
QList<int> list2 = QtConcurrent::mappedReduced(list,
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
@@ -1393,14 +1395,14 @@ void tst_QtConcurrentMap::mappedReduced()
QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
list.constEnd(),
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
@@ -1463,20 +1465,20 @@ void tst_QtConcurrentMap::mappedReduced()
{
QList<int> list2 = QtConcurrent::mappedReduced(numberList,
&Number::toInt,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list2, QList<int>() << 1 << 2 << 3);
QList<int> list3 = QtConcurrent::mappedReduced(numberList.constBegin(),
numberList.constEnd(),
&Number::toInt,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list3, QList<int>() << 1 << 2 << 3);
QList<int> list4 = QtConcurrent::mappedReduced(QList<Number>(numberList),
&Number::toInt,
- &QList<int>::push_back, OrderedReduce);
+ push_back, OrderedReduce);
QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
}
{
@@ -1503,7 +1505,7 @@ void tst_QtConcurrentMap::mappedReduced()
{
QList<int> list2 = QtConcurrent::mappedReduced(list,
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
@@ -1511,14 +1513,14 @@ void tst_QtConcurrentMap::mappedReduced()
QList<int> list3 = QtConcurrent::mappedReduced(list.constBegin(),
list.constEnd(),
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
QList<int> list4 = QtConcurrent::mappedReduced(QList<int>(list),
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
@@ -1759,11 +1761,13 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(sum3, 14);
}
+ auto push_back = static_cast<void (QVector<int>::*)(const int &)>(&QVector<int>::push_back);
+
// functor-member
{
QList<int> list2 = QtConcurrent::blockingMappedReduced(list,
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
@@ -1771,14 +1775,14 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QList<int> list3 = QtConcurrent::blockingMappedReduced(list.constBegin(),
list.constEnd(),
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
QList<int> list4 = QtConcurrent::blockingMappedReduced(QList<int>(list),
IntSquare(),
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
@@ -1842,20 +1846,20 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
{
QList<int> list2 = QtConcurrent::blockingMappedReduced(numberList,
&Number::toInt,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list2, QList<int>() << 1 << 2 << 3);
QList<int> list3 = QtConcurrent::blockingMappedReduced(numberList.constBegin(),
numberList.constEnd(),
&Number::toInt,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list3, QList<int>() << 1 << 2 << 3);
QList<int> list4 = QtConcurrent::blockingMappedReduced(QList<Number>(numberList),
&Number::toInt,
- &QList<int>::push_back, OrderedReduce);
+ push_back, OrderedReduce);
QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
}
{
@@ -1882,7 +1886,7 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
{
QList<int> list2 = QtConcurrent::blockingMappedReduced(list,
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list2, QList<int>() << 1 << 4 << 9);
@@ -1890,14 +1894,14 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QList<int> list3 = QtConcurrent::blockingMappedReduced(list.constBegin(),
list.constEnd(),
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list3, QList<int>() << 1 << 4 << 9);
QList<int> list4 = QtConcurrent::blockingMappedReduced(QList<int>(list),
intSquare,
- &QList<int>::push_back,
+ push_back,
OrderedReduce);
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
@@ -2118,7 +2122,6 @@ public:
};
Q_DECLARE_METATYPE(QVector<MemFnTester>);
-Q_DECLARE_METATYPE(QList<MemFnTester>);
void tst_QtConcurrentMap::functionOverloads()
{
diff --git a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro
index 0d07642028..59e22d24a1 100644
--- a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro
+++ b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qtconcurrentmedian
QT = core testlib concurrent
SOURCES = tst_qtconcurrentmedian.cpp
-DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index b33dec8a61..047130d5ea 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -49,7 +49,6 @@ private slots:
void qConstructorFunction();
void qCoreAppStartupFunction();
void qCoreAppStartupFunctionRestart();
- void qAlignOf();
void integerForSize();
void qprintable();
void qprintable_data();
@@ -434,106 +433,6 @@ template <class T> struct AlignmentInStruct { T dummy; };
typedef int (*fun) ();
typedef int (Empty::*memFun) ();
-#define TEST_AlignOf(type, alignment) \
- do { \
- TEST_AlignOf_impl(type, alignment); \
- \
- TEST_AlignOf_impl(type &, alignment); \
- TEST_AlignOf_RValueRef(type &&, alignment); \
- \
- TEST_AlignOf_impl(type [5], alignment); \
- TEST_AlignOf_impl(type (&) [5], alignment); \
- \
- TEST_AlignOf_impl(AlignmentInStruct<type>, alignment); \
- \
- /* Some internal sanity validation, just for fun */ \
- TEST_AlignOf_impl(AlignmentInStruct<type [5]>, alignment); \
- TEST_AlignOf_impl(AlignmentInStruct<type &>, Q_ALIGNOF(void *)); \
- TEST_AlignOf_impl(AlignmentInStruct<type (&) [5]>, \
- Q_ALIGNOF(void *)); \
- TEST_AlignOf_RValueRef(AlignmentInStruct<type &&>, \
- Q_ALIGNOF(void *)); \
- } while (false) \
- /**/
-
-#define TEST_AlignOf_RValueRef(type, alignment) \
- TEST_AlignOf_impl(type, alignment)
-
-#define TEST_AlignOf_impl(type, alignment) \
- do { \
- QCOMPARE(Q_ALIGNOF(type), size_t(alignment)); \
- /* Compare to native operator for compilers that support it,
- otherwise... erm... check consistency! :-) */ \
- QCOMPARE(alignof(type), Q_ALIGNOF(type)); \
- } while (false)
- /**/
-
-void tst_QGlobal::qAlignOf()
-{
- // Built-in types, except 64-bit integers and double
- TEST_AlignOf(char, 1);
- TEST_AlignOf(signed char, 1);
- TEST_AlignOf(unsigned char, 1);
- TEST_AlignOf(qint8, 1);
- TEST_AlignOf(quint8, 1);
- TEST_AlignOf(qint16, 2);
- TEST_AlignOf(quint16, 2);
- TEST_AlignOf(qint32, 4);
- TEST_AlignOf(quint32, 4);
- TEST_AlignOf(void *, sizeof(void *));
-
- // Depends on platform and compiler, disabling test for now
- // TEST_AlignOf(long double, 16);
-
- // Empty struct
- TEST_AlignOf(Empty, 1);
-
- // Function pointers
- TEST_AlignOf(fun, Q_ALIGNOF(void *));
- TEST_AlignOf(memFun, Q_ALIGNOF(void *));
-
-
- // 64-bit integers and double
- TEST_AlignOf_impl(qint64, 8);
- TEST_AlignOf_impl(quint64, 8);
- TEST_AlignOf_impl(double, 8);
-
- TEST_AlignOf_impl(qint64 &, 8);
- TEST_AlignOf_impl(quint64 &, 8);
- TEST_AlignOf_impl(double &, 8);
-
- TEST_AlignOf_RValueRef(qint64 &&, 8);
- TEST_AlignOf_RValueRef(quint64 &&, 8);
- TEST_AlignOf_RValueRef(double &&, 8);
-
- // 32-bit x86 ABI idiosyncrasies
-#if defined(Q_PROCESSOR_X86_32) && !defined(Q_OS_WIN)
- TEST_AlignOf_impl(AlignmentInStruct<qint64>, 4);
-#else
- TEST_AlignOf_impl(AlignmentInStruct<qint64>, 8);
-#endif
-
- TEST_AlignOf_impl(AlignmentInStruct<quint64>, Q_ALIGNOF(AlignmentInStruct<qint64>));
- TEST_AlignOf_impl(AlignmentInStruct<double>, Q_ALIGNOF(AlignmentInStruct<qint64>));
-
- // 32-bit x86 ABI, Clang disagrees with gcc
-#if !defined(Q_PROCESSOR_X86_32) || !defined(Q_CC_CLANG) || defined(Q_OS_ANDROID)
- TEST_AlignOf_impl(qint64 [5], Q_ALIGNOF(qint64));
-#else
- TEST_AlignOf_impl(qint64 [5], Q_ALIGNOF(AlignmentInStruct<qint64>));
-#endif
-
- TEST_AlignOf_impl(qint64 (&) [5], Q_ALIGNOF(qint64 [5]));
- TEST_AlignOf_impl(quint64 [5], Q_ALIGNOF(quint64 [5]));
- TEST_AlignOf_impl(quint64 (&) [5], Q_ALIGNOF(quint64 [5]));
- TEST_AlignOf_impl(double [5], Q_ALIGNOF(double [5]));
- TEST_AlignOf_impl(double (&) [5], Q_ALIGNOF(double [5]));
-}
-
-#undef TEST_AlignOf
-#undef TEST_AlignOf_RValueRef
-#undef TEST_AlignOf_impl
-
void tst_QGlobal::integerForSize()
{
// compile-only test:
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 09ef0ea44f..ebb9a0a44c 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -116,7 +116,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe
reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) {
result = GetLastError();
QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", "
- << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result
+ << nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result
<< ": " << qt_error_string(int(result));
}
return result;
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index 54b2e0a0e2..f3b3ede575 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -1,65 +1,51 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>extras/test</file>
- <file>extras/test2</file>
- <file>extras/+custom1/test</file>
- <file>extras/+custom1/test3</file>
- <file>extras/+custom2/test</file>
- <file>extras/+custom3/test</file>
- <file>extras/+custom3/+custom2/test</file>
- <file>extras/+custom3/+custom4/test</file>
- <file>extras/+custom3/+custom5/test</file>
- <file>extras/+custom5/+custom3/test</file>
-
- <!-- platforms/test: deepest possible selection -->
- <file>platforms/test</file>
- <file>platforms/+unix/+android/test</file>
- <file>platforms/+unix/+darwin/+mac/+ios/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/test</file>
- <file>platforms/+unix/+darwin/+mac/test</file>
- <file>platforms/+unix/+darwin/test</file>
- <file>platforms/+unix/+haiku/test</file>
- <file>platforms/+unix/+linux/test</file>
- <file>platforms/+unix/+qnx/test</file>
- <file>platforms/+unix/test</file>
- <file>platforms/+windows/+wince/test</file>
- <file>platforms/+windows/+winnt/test</file>
- <file>platforms/+windows/+winrt/test</file>
- <file>platforms/+windows/test</file>
- <file>platforms/+android/test</file>
- <file>platforms/+ios/test</file>
- <file>platforms/+macos/test</file>
- <file>platforms/+osx/test</file>
- <file>platforms/+darwin/test</file>
- <file>platforms/+mac/test</file>
- <file>platforms/+haiku/test</file>
- <file>platforms/+linux/test</file>
- <file>platforms/+qnx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+winrt/test</file>
-
- <!-- platforms/test2: shallow selection for the deepest selector -->
- <file>platforms/test2</file>
- <file>platforms/+android/test2</file>
- <file>platforms/+ios/test2</file>
- <file>platforms/+macos/test2</file>
- <file>platforms/+haiku/test2</file>
- <file>platforms/+linux/test2</file>
- <file>platforms/+qnx/test2</file>
- <file>platforms/+wince/test2</file>
- <file>platforms/+winnt/test2</file>
- <file>platforms/+winrt/test2</file>
-
- <!-- platforms/test3: selection for the family only -->
- <file>platforms/test3</file>
- <file>platforms/+windows/test3</file>
- <file>platforms/+unix/test3</file>
-
- <!-- platforms/test4 and 5: special cases for macOS -->
- <file>platforms/test4</file>
- <file>platforms/+osx/test4</file>
- <file>platforms/test5</file>
- <file>platforms/+mac/test5</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>extras/test</file>
+ <file>extras/test2</file>
+ <file>extras/+custom1/test</file>
+ <file>extras/+custom1/test3</file>
+ <file>extras/+custom2/test</file>
+ <file>extras/+custom3/test</file>
+ <file>extras/+custom3/+custom2/test</file>
+ <file>extras/+custom3/+custom4/test</file>
+ <file>extras/+custom3/+custom5/test</file>
+ <file>extras/+custom5/+custom3/test</file>
+ <file>platforms/test</file>
+ <file>platforms/+unix/+android/test</file>
+ <file>platforms/+unix/+darwin/test</file>
+ <file>platforms/+unix/+haiku/test</file>
+ <file>platforms/+unix/+linux/test</file>
+ <file>platforms/+unix/+qnx/test</file>
+ <file>platforms/+unix/test</file>
+ <file>platforms/+windows/+wince/test</file>
+ <file>platforms/+windows/+winnt/test</file>
+ <file>platforms/+windows/+winrt/test</file>
+ <file>platforms/+windows/test</file>
+ <file>platforms/+android/test</file>
+ <file>platforms/+ios/test</file>
+ <file>platforms/+macos/test</file>
+ <file>platforms/+darwin/test</file>
+ <file>platforms/+haiku/test</file>
+ <file>platforms/+linux/test</file>
+ <file>platforms/+qnx/test</file>
+ <file>platforms/+wince/test</file>
+ <file>platforms/+winrt/test</file>
+ <file>platforms/test2</file>
+ <file>platforms/+android/test2</file>
+ <file>platforms/+ios/test2</file>
+ <file>platforms/+macos/test2</file>
+ <file>platforms/+haiku/test2</file>
+ <file>platforms/+linux/test2</file>
+ <file>platforms/+qnx/test2</file>
+ <file>platforms/+wince/test2</file>
+ <file>platforms/+winnt/test2</file>
+ <file>platforms/+winrt/test2</file>
+ <file>platforms/test3</file>
+ <file>platforms/+windows/test3</file>
+ <file>platforms/+unix/test3</file>
+ <file>platforms/test4</file>
+ <file>platforms/test5</file>
+ <file>platforms/+unix/+darwin/+macos/test</file>
+ <file>platforms/+unix/+darwin/+ios/test</file>
+ </qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 11b1fdaeeb..bac7a69e0f 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data()
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
<< expectedPlatform3File;
-#ifdef Q_OS_MACOS
- // special case for compatibility code
- QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList()
- << ":/platforms/+osx/test4";
- QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList()
- << ":/platforms/+mac/test5";
-#endif
-
QString resourceTestPath(":/extras/test");
QString custom1("custom1");
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 0f07ba4bb2..c969e72c18 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -39,7 +39,9 @@
#include <QtCore/QDir>
#include <QtCore/QThread>
#include <QtCore/QSysInfo>
-#include <QtGui/QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QtGui/QKeySequence>
+#endif
#include <QtCore>
#include <QtGui>
@@ -1364,6 +1366,7 @@ void tst_QSettings::testVariantTypes()
dt.setOffsetFromUtc(3600);
testVal("key14", dt, QDateTime, DateTime);
+#if QT_CONFIG(shortcut)
// We store key sequences as strings instead of binary variant blob, for improved
// readability in the resulting format.
if (format >= QSettings::InvalidFormat) {
@@ -1373,6 +1376,7 @@ void tst_QSettings::testVariantTypes()
QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
QString, String);
}
+#endif // QT_CONFIG(shortcut)
#undef testVal
}
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 60000316cc..c83e7af503 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -1320,13 +1320,13 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("function ptr spaces") << "void foo( void ( * ) ( void ))" << "void foo(void(*)())";
QTest::newRow("function ptr void*") << "void foo(void(*)(void*))" << "void foo(void(*)(void*))";
QTest::newRow("function ptr void* spaces") << "void foo( void ( * ) ( void * ))" << "void foo(void(*)(void*))";
- QTest::newRow("template args") << " void foo( QMap<a, a>, QList<b>) "
- << "void foo(QMap<a,a>,QList<b>)";
+ QTest::newRow("template args") << " void foo( QMap<a, a>, QVector<b>) "
+ << "void foo(QMap<a,a>,QVector<b>)";
QTest::newRow("void template args") << " void foo( Foo<void>, Bar<void> ) "
<< "void foo(Foo<void>,Bar<void>)";
QTest::newRow("void* template args") << " void foo( Foo<void*>, Bar<void *> ) "
<< "void foo(Foo<void*>,Bar<void*>)";
- QTest::newRow("rettype") << "QList<int, int> foo()" << "QList<int,int>foo()";
+ QTest::newRow("rettype") << "QVector<int, int> foo()" << "QVector<int,int>foo()";
QTest::newRow("rettype void template") << "Foo<void> foo()" << "Foo<void>foo()";
QTest::newRow("const rettype") << "const QString *foo()" << "const QString*foo()";
QTest::newRow("const ref") << "const QString &foo()" << "const QString&foo()";
@@ -1337,15 +1337,16 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("const4") << "void foo(const int)" << "void foo(int)";
QTest::newRow("const5") << "void foo(const int, int const, const int &, int const &)"
<< "void foo(int,int,int,int)";
- QTest::newRow("const6") << "void foo(QList<const int>)" << "void foo(QList<const int>)";
- QTest::newRow("const7") << "void foo(QList<const int*>)" << "void foo(QList<const int*>)";
- QTest::newRow("const8") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)";
+ QTest::newRow("const6") << "void foo(QVector<const int>)" << "void foo(QVector<const int>)";
+ QTest::newRow("const7") << "void foo(QVector<const int*>)" << "void foo(QVector<const int*>)";
+ QTest::newRow("const8") << "void foo(QVector<int const*>)" << "void foo(QVector<const int*>)";
QTest::newRow("const9") << "void foo(const Foo<Bar>)" << "void foo(Foo<Bar>)";
QTest::newRow("const10") << "void foo(Foo<Bar>const)" << "void foo(Foo<Bar>)";
QTest::newRow("const11") << "void foo(Foo<Bar> *const)" << "void foo(Foo<Bar>*const)";
QTest::newRow("const12") << "void foo(Foo<Bar>const*const *const)" << "void foo(Foo<Bar>*const*const)";
QTest::newRow("const13") << "void foo(const Foo<Bar>&)" << "void foo(Foo<Bar>)";
QTest::newRow("const14") << "void foo(Foo<Bar>const&)" << "void foo(Foo<Bar>)";
+ QTest::newRow("QList") << "void foo(QList<int>)" << "void foo(QVector<int>)";
QTest::newRow("invalid1") << "a( b" << "a(b";
}
@@ -1367,13 +1368,13 @@ void tst_QMetaObject::normalizedType_data()
QTest::newRow("white") << " int " << "int";
QTest::newRow("const1") << "int const *" << "const int*";
QTest::newRow("const2") << "const int *" << "const int*";
- QTest::newRow("template1") << "QList<int const *>" << "QList<const int*>";
- QTest::newRow("template2") << "QList<const int *>" << "QList<const int*>";
+ QTest::newRow("template1") << "QVector<int const *>" << "QVector<const int*>";
+ QTest::newRow("template2") << "QVector<const int *>" << "QVector<const int*>";
QTest::newRow("template3") << "QMap<QString, int>" << "QMap<QString,int>";
QTest::newRow("template4") << "const QMap<QString, int> &" << "QMap<QString,int>";
- QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>";
- QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>";
- QTest::newRow("template7") << "QList<QList<int> >" << "QList<QList<int> >";
+ QTest::newRow("template5") << "QVector< ::Foo::Bar>" << "QVector< ::Foo::Bar>";
+ QTest::newRow("template6") << "QVector<::Foo::Bar>" << "QVector<::Foo::Bar>";
+ QTest::newRow("template7") << "QVector<QVector<int> >" << "QVector<QVector<int> >";
QTest::newRow("template8") << "QMap<const int, const short*>" << "QMap<const int,const short*>";
QTest::newRow("template9") << "QPair<const QPair<int, int const *> , QPair<QHash<int, const char*> > >" << "QPair<const QPair<int,const int*>,QPair<QHash<int,const char*> > >";
QTest::newRow("value1") << "const QString &" << "QString";
@@ -1387,6 +1388,7 @@ void tst_QMetaObject::normalizedType_data()
QTest::newRow("struct2") << "struct foo const*" << "const foo*";
QTest::newRow("enum") << "enum foo" << "foo";
QTest::newRow("void") << "void" << "void";
+ QTest::newRow("QList") << "QList<int>" << "QVector<int>";
}
void tst_QMetaObject::normalizedType()
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 9fe7d63727..14719f36f8 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -1702,9 +1702,10 @@ void tst_QMetaObjectBuilder::classNameFirstInStringData()
builder.setClassName(QByteArrayLiteral("TestClass"));
QMetaObject *mo = builder.toMetaObject();
- QByteArrayDataPtr header;
- header.ptr = const_cast<QByteArrayData*>(mo->d.stringdata);
- QCOMPARE(QByteArray(header), QByteArrayLiteral("TestClass"));
+ uint offset = mo->d.stringdata[0];
+ uint len = mo->d.stringdata[1];
+ QByteArray className(reinterpret_cast<const char *>(mo->d.stringdata) + offset, len);
+ QCOMPARE(className, QByteArrayLiteral("TestClass"));
free(mo);
}
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 19b3289390..4e30f210b1 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -120,8 +120,6 @@ private slots:
void constRefs();
void convertCustomType_data();
void convertCustomType();
- void compareCustomType_data();
- void compareCustomType();
void compareCustomEqualOnlyType();
void customDebugStream();
void unknownType();
@@ -574,12 +572,14 @@ void tst_QMetaType::typeName_data()
QTest::newRow("124125534") << 124125534 << QString();
// automatic registration
- QTest::newRow("QList<int>") << ::qMetaTypeId<QList<int> >() << QString::fromLatin1("QList<int>");
QTest::newRow("QHash<int,int>") << ::qMetaTypeId<QHash<int, int> >() << QString::fromLatin1("QHash<int,int>");
QTest::newRow("QMap<int,int>") << ::qMetaTypeId<QMap<int, int> >() << QString::fromLatin1("QMap<int,int>");
- QTest::newRow("QVector<QList<int>>") << ::qMetaTypeId<QVector<QList<int> > >() << QString::fromLatin1("QVector<QList<int> >");
QTest::newRow("QVector<QMap<int,int>>") << ::qMetaTypeId<QVector<QMap<int, int> > >() << QString::fromLatin1("QVector<QMap<int,int> >");
+ // automatic registration with automatic QList to QVector aliasing
+ QTest::newRow("QList<int>") << ::qMetaTypeId<QList<int> >() << QString::fromLatin1("QVector<int>");
+ QTest::newRow("QVector<QList<int>>") << ::qMetaTypeId<QVector<QList<int> > >() << QString::fromLatin1("QVector<QVector<int> >");
+
QTest::newRow("CustomQObject*") << ::qMetaTypeId<CustomQObject*>() << QString::fromLatin1("CustomQObject*");
QTest::newRow("CustomGadget") << ::qMetaTypeId<CustomGadget>() << QString::fromLatin1("CustomGadget");
QTest::newRow("CustomGadget*") << ::qMetaTypeId<CustomGadget*>() << QString::fromLatin1("CustomGadget*");
@@ -1032,9 +1032,9 @@ static void testConstructHelper()
typedef typename MetaEnumToType<ID>::Type Type;
QMetaType info(ID);
int size = info.sizeOf();
- void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage1 = qMallocAligned(size, alignof(Type));
void *actual1 = QMetaType::construct(ID, storage1, /*copy=*/0);
- void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage2 = qMallocAligned(size, alignof(Type));
void *actual2 = info.construct(storage2, /*copy=*/0);
QCOMPARE(actual1, storage1);
QCOMPARE(actual2, storage2);
@@ -1186,9 +1186,9 @@ static void testConstructCopyHelper()
QMetaType info(ID);
int size = QMetaType::sizeOf(ID);
QCOMPARE(info.sizeOf(), size);
- void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage1 = qMallocAligned(size, alignof(Type));
void *actual1 = QMetaType::construct(ID, storage1, expected);
- void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage2 = qMallocAligned(size, alignof(Type));
void *actual2 = info.construct(storage2, expected);
QCOMPARE(actual1, storage1);
QCOMPARE(actual2, storage2);
@@ -2017,7 +2017,7 @@ void tst_QMetaType::metaObject_data()
QTest::newRow("MyGadget") << ::qMetaTypeId<MyGadget>() << &MyGadget::staticMetaObject << true << false << false;
QTest::newRow("MyGadget*") << ::qMetaTypeId<MyGadget*>() << &MyGadget::staticMetaObject << false << true << false;
QTest::newRow("MyEnum") << ::qMetaTypeId<MyGadget::MyEnum>() << &MyGadget::staticMetaObject << false << false << false;
- QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &QObject::staticQtMetaObject << false << false << false;
+ QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &Qt::staticMetaObject << false << false << false;
QTest::newRow("MyQObjectFromGadget*") << ::qMetaTypeId<MyQObjectFromGadget*>() << &MyQObjectFromGadget::staticMetaObject << false << false << true;
QTest::newRow("GadgetDerivedAndTyped<int>") << ::qMetaTypeId<GadgetDerivedAndTyped<int>>() << &GadgetDerivedAndTyped<int>::staticMetaObject << true << false << false;
@@ -2139,7 +2139,7 @@ struct CustomConvertibleType
};
bool operator<(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
-{ return lhs.m_foo < rhs.m_foo; }
+{ return lhs.m_foo.toString() < rhs.m_foo.toString(); }
bool operator==(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
{ return lhs.m_foo == rhs.m_foo; }
bool operator!=(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
@@ -2429,43 +2429,6 @@ void tst_QMetaType::convertCustomType()
QCOMPARE(v.value<CustomConvertibleType2>().m_foo, testCustom.m_foo);
}
-void tst_QMetaType::compareCustomType_data()
-{
- QMetaType::registerComparators<CustomConvertibleType>();
-
- QTest::addColumn<QVariantList>("unsorted");
- QTest::addColumn<QVariantList>("sorted");
-
- QTest::newRow("int") << (QVariantList() << 37 << 458 << 1 << 243 << -4 << 383)
- << (QVariantList() << -4 << 1 << 37 << 243 << 383 << 458);
-
- QTest::newRow("dobule") << (QVariantList() << 4934.93 << 0.0 << 302.39 << -39.0)
- << (QVariantList() << -39.0 << 0.0 << 302.39 << 4934.93);
-
- QTest::newRow("QString") << (QVariantList() << "Hello" << "World" << "this" << "is" << "a" << "test")
- << (QVariantList() << "a" << "Hello" << "is" << "test" << "this" << "World");
-
- QTest::newRow("QTime") << (QVariantList() << QTime(14, 39) << QTime(0, 0) << QTime(18, 18) << QTime(9, 27))
- << (QVariantList() << QTime(0, 0) << QTime(9, 27) << QTime(14, 39) << QTime(18, 18));
-
- QTest::newRow("QDate") << (QVariantList() << QDate(2013, 3, 23) << QDate(1900, 12, 1) << QDate(2001, 2, 2) << QDate(1982, 12, 16))
- << (QVariantList() << QDate(1900, 12, 1) << QDate(1982, 12, 16) << QDate(2001, 2, 2) << QDate(2013, 3, 23));
-
- QTest::newRow("mixed") << (QVariantList() << "Hello" << "World" << QChar('a') << 38 << QChar('z') << -39 << 4.6)
- << (QVariantList() << -39 << 4.6 << 38 << QChar('a') << "Hello" << "World" << QChar('z'));
-
- QTest::newRow("custom") << (QVariantList() << QVariant::fromValue(CustomConvertibleType(1)) << QVariant::fromValue(CustomConvertibleType(100)) << QVariant::fromValue(CustomConvertibleType(50)))
- << (QVariantList() << QVariant::fromValue(CustomConvertibleType(1)) << QVariant::fromValue(CustomConvertibleType(50)) << QVariant::fromValue(CustomConvertibleType(100)));
-}
-
-void tst_QMetaType::compareCustomType()
-{
- QFETCH(QVariantList, unsorted);
- QFETCH(QVariantList, sorted);
- std::sort(unsorted.begin(), unsorted.end());
- QCOMPARE(unsorted, sorted);
-}
-
void tst_QMetaType::compareCustomEqualOnlyType()
{
int metaTypeId = qRegisterMetaType<CustomEqualsOnlyType>();
@@ -2487,11 +2450,6 @@ void tst_QMetaType::compareCustomEqualOnlyType()
QCOMPARE(variant100, variant100x);
QCOMPARE(variant100, variant100);
- // compare always fails
- QVERIFY(!(variant50 < variant50));
- QVERIFY(!(variant50 < variant100));
- QVERIFY(!(variant100 < variant50));
-
// check QMetaType::compare works/doesn't crash for equals only comparators
bool wasSuccess = QMetaType::compare(variant50.constData(), variant50.constData(),
metaTypeId, &result);
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index a805bfb747..91ea83be3d 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -81,9 +81,6 @@ private slots:
void senderTest();
void declareInterface();
void qpointerResetBeforeDestroyedSignal();
-#ifndef QT_NO_USERDATA
- void testUserData();
-#endif
void childDeletesItsSibling();
void dynamicProperties();
void floatProperty();
@@ -463,7 +460,7 @@ void tst_QObject::connectSlotsByName()
sender.setObjectName("Sender");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()");
- QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: QVector(\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QMetaObject::connectSlotsByName(&receiver);
receiver.called_slots.clear();
@@ -2341,51 +2338,6 @@ void tst_QObject::declareInterface()
}
-#ifndef QT_NO_USERDATA
-class CustomData : public QObjectUserData
-{
-public:
- int id;
-};
-
-void tst_QObject::testUserData()
-{
- const int USER_DATA_COUNT = 100;
- int user_data_ids[USER_DATA_COUNT];
-
- // Register a few
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- user_data_ids[i] = QObject::registerUserData();
- }
-
- // Randomize the table a bit
- for (int i=0; i<100; ++i) {
- int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
- int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
-
- int tmp = user_data_ids[p1];
- user_data_ids[p1] = user_data_ids[p2];
- user_data_ids[p2] = tmp;
- }
-
- // insert the user data into an object
- QObject my_test_object;
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- CustomData *data = new CustomData;
- data->id = user_data_ids[i];
- my_test_object.setUserData(data->id, data);
- }
-
- // verify that all ids and positions are matching
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- int id = user_data_ids[i];
- CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
- QVERIFY(data != nullptr);
- QCOMPARE(data->id, id);
- }
-}
-#endif // QT_NO_USERDATA
-
class DestroyedListener : public QObject
{
Q_OBJECT
@@ -6974,8 +6926,7 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction()
QObject *parent = new QObject;
QObject *child = new QObject;
- QAbstractDeclarativeDataImpl dummy;
- dummy.ownedByQml1 = false;
+ QAbstractDeclarativeData dummy;
QObjectPrivate::get(child)->declarativeData = &dummy;
parentChangeCalled = false;
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 9e0881f1a6..c4af2267a8 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -189,8 +189,6 @@ private slots:
void operator_eq_eq_data();
void operator_eq_eq();
void operator_eq_eq_rhs();
- void compareNumbers_data() const;
- void compareNumbers() const;
void typeName_data();
void typeName();
@@ -269,9 +267,6 @@ private slots:
void enums();
void metaEnums();
- void compareSanity_data();
- void compareSanity();
- void compareRich();
void nullConvert();
@@ -1726,344 +1721,6 @@ void tst_QVariant::operator_eq_eq_rhs()
#endif
}
-void tst_QVariant::compareNumbers_data() const
-{
- typedef signed char schar;
- QTest::addColumn<QVariant>("v1");
- QTest::addColumn<QVariant>("v2");
- QTest::addColumn<int>("expected");
-
- // sanity checking: same types
- QTest::newRow("bool1") << QVariant(false) << QVariant(false) << 0;
- QTest::newRow("bool2") << QVariant(true) << QVariant(true) << 0;
- QTest::newRow("bool3") << QVariant(false) << QVariant(true) << -1;
- QTest::newRow("bool4") << QVariant(true) << QVariant(false) << +1;
-
- QTest::newRow("char1") << QVariant::fromValue(char(0)) << QVariant::fromValue(char(0)) << 0;
- QTest::newRow("char2") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(CHAR_MAX) << 0;
- QTest::newRow("char3") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(CHAR_MIN) << 0;
- QTest::newRow("char4") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(CHAR_MAX) << -1;
- QTest::newRow("char5") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(CHAR_MIN) << +1;
-
- QTest::newRow("schar1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(schar(0)) << 0;
- QTest::newRow("schar2") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(SCHAR_MAX) << 0;
- QTest::newRow("schar3") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(SCHAR_MIN) << 0;
- QTest::newRow("schar4") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(SCHAR_MAX) << -1;
- QTest::newRow("schar5") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(SCHAR_MIN) << +1;
-
- QTest::newRow("uchar1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(uchar(0)) << 0;
- QTest::newRow("uchar2") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(UCHAR_MAX) << 0;
- QTest::newRow("uchar3") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(UCHAR_MAX) << -1;
- QTest::newRow("uchar4") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(uchar(0)) << +1;
-
- QTest::newRow("short1") << QVariant::fromValue(short(0)) << QVariant::fromValue(short(0)) << 0;
- QTest::newRow("short2") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(SHRT_MAX) << 0;
- QTest::newRow("short3") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(SHRT_MIN) << 0;
- QTest::newRow("short4") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(SHRT_MAX) << -1;
- QTest::newRow("short5") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(SHRT_MIN) << +1;
-
- QTest::newRow("ushort1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(ushort(0)) << 0;
- QTest::newRow("ushort2") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(USHRT_MAX) << 0;
- QTest::newRow("ushort3") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(USHRT_MAX) << -1;
- QTest::newRow("ushort4") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(ushort(0)) << +1;
-
- QTest::newRow("int1") << QVariant::fromValue(int(0)) << QVariant::fromValue(int(0)) << 0;
- QTest::newRow("int2") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(INT_MAX) << 0;
- QTest::newRow("int3") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(INT_MIN) << 0;
- QTest::newRow("int4") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("int5") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(INT_MIN) << +1;
-
- QTest::newRow("uint1") << QVariant::fromValue(uint(0)) << QVariant::fromValue(uint(0)) << 0;
- QTest::newRow("uint2") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("uint3") << QVariant::fromValue(uint(0)) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("uint4") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(uint(0)) << +1;
-
- QTest::newRow("long1") << QVariant::fromValue(long(0)) << QVariant::fromValue(long(0)) << 0;
- QTest::newRow("long2") << QVariant::fromValue(LONG_MAX) << QVariant::fromValue(LONG_MAX) << 0;
- QTest::newRow("long3") << QVariant::fromValue(LONG_MIN) << QVariant::fromValue(LONG_MIN) << 0;
- QTest::newRow("long4") << QVariant::fromValue(LONG_MIN) << QVariant::fromValue(LONG_MAX) << -1;
- QTest::newRow("long5") << QVariant::fromValue(LONG_MAX) << QVariant::fromValue(LONG_MIN) << +1;
-
- QTest::newRow("ulong1") << QVariant::fromValue(ulong(0)) << QVariant::fromValue(ulong(0)) << 0;
- QTest::newRow("ulong2") << QVariant::fromValue(ULONG_MAX) << QVariant::fromValue(ULONG_MAX) << 0;
- QTest::newRow("ulong3") << QVariant::fromValue(ulong(0)) << QVariant::fromValue(ULONG_MAX) << -1;
- QTest::newRow("ulong4") << QVariant::fromValue(ULONG_MAX) << QVariant::fromValue(ulong(0)) << +1;
-
- QTest::newRow("llong1") << QVariant::fromValue(qlonglong(0)) << QVariant::fromValue(qlonglong(0)) << 0;
- QTest::newRow("llong2") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(LLONG_MAX) << 0;
- QTest::newRow("llong3") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(LLONG_MIN) << 0;
- QTest::newRow("llong4") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("llong5") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(LLONG_MIN) << +1;
-
- QTest::newRow("ullong1") << QVariant::fromValue(qulonglong(0)) << QVariant::fromValue(qulonglong(0)) << 0;
- QTest::newRow("ullong2") << QVariant::fromValue(ULLONG_MAX) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("ullong3") << QVariant::fromValue(qulonglong(0)) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("ullong4") << QVariant::fromValue(ULLONG_MAX) << QVariant::fromValue(qulonglong(0)) << +1;
-
- QTest::newRow("float1") << QVariant::fromValue(0.f) << QVariant::fromValue(0.f) << 0;
- QTest::newRow("float2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0.f) << -1;
- QTest::newRow("float3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1.f) << +1;
- QTest::newRow("float4") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(0.f) << -1;
- QTest::newRow("float5") << QVariant::fromValue(0.f) << QVariant::fromValue(-float(qInf())) << +1;
- QTest::newRow("float6") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(-float(qInf())) << 0;
- QTest::newRow("float7") << QVariant::fromValue(float(qInf())) << QVariant::fromValue(float(qInf())) << 0;
-
- QTest::newRow("double1") << QVariant::fromValue(0.) << QVariant::fromValue(0.) << 0;
- QTest::newRow("double2") << QVariant::fromValue(-1.) << QVariant::fromValue(0.) << -1;
- QTest::newRow("double3") << QVariant::fromValue(0.) << QVariant::fromValue(-1.) << +1;
- QTest::newRow("double4") << QVariant::fromValue(-qInf()) << QVariant::fromValue(0.) << -1;
- QTest::newRow("double5") << QVariant::fromValue(0.) << QVariant::fromValue(-qInf()) << +1;
- QTest::newRow("double6") << QVariant::fromValue(-double(qInf())) << QVariant::fromValue(-qInf()) << 0;
- QTest::newRow("double7") << QVariant::fromValue(qInf()) << QVariant::fromValue(qInf()) << 0;
- QTest::newRow("double8") << QVariant::fromValue(-qInf()) << QVariant::fromValue(qInf()) << -1;
- QTest::newRow("double9") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(0.) << INT_MAX;
- QTest::newRow("double10") << QVariant::fromValue(0.) << QVariant::fromValue(qQNaN()) << INT_MAX;
- QTest::newRow("double11") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(qQNaN()) << INT_MAX;
-
- // mixed comparisons
- // fp + fp
- QTest::newRow("float+double1") << QVariant::fromValue(0.f) << QVariant::fromValue(0.) << 0;
- QTest::newRow("float+double2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0.) << -1;
- QTest::newRow("float+double3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1.) << +1;
- QTest::newRow("float+double4") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(0.) << -1;
- QTest::newRow("float+double5") << QVariant::fromValue(0.f) << QVariant::fromValue(-qInf()) << +1;
- QTest::newRow("float+double6") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(-qInf()) << 0;
- QTest::newRow("float+double7") << QVariant::fromValue(float(qInf())) << QVariant::fromValue(qInf()) << 0;
- QTest::newRow("float+double8") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(qInf()) << -1;
- QTest::newRow("float+double9") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(0.) << INT_MAX;
- QTest::newRow("float+double10") << QVariant::fromValue(0.) << QVariant::fromValue(qQNaN()) << INT_MAX;
- QTest::newRow("float+double11") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(qQNaN()) << INT_MAX;
-
- // fp + int
- QTest::newRow("float+int1") << QVariant::fromValue(0.f) << QVariant::fromValue(0) << 0;
- QTest::newRow("double+int1") << QVariant::fromValue(0.) << QVariant::fromValue(0) << 0;
- QTest::newRow("float+int2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0) << -1;
- QTest::newRow("double+int2") << QVariant::fromValue(-1.) << QVariant::fromValue(0) << -1;
- QTest::newRow("float+int3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1) << +1;
- QTest::newRow("double+int3") << QVariant::fromValue(0.) << QVariant::fromValue(-1) << +1;
- QTest::newRow("float+int4") << QVariant::fromValue(1.5f) << QVariant::fromValue(1) << +1;
- QTest::newRow("double+int4") << QVariant::fromValue(1.5) << QVariant::fromValue(1) << +1;
- QTest::newRow("double+int5") << QVariant::fromValue(qInf()) << QVariant::fromValue(1) << +1;
-
- // fp + uint
- QTest::newRow("float+uint1") << QVariant::fromValue(0.f) << QVariant::fromValue(0U) << 0;
- QTest::newRow("double+uint1") << QVariant::fromValue(0.) << QVariant::fromValue(0U) << 0;
- QTest::newRow("float+uint2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0U) << -1;
- QTest::newRow("double+uint2") << QVariant::fromValue(-1.) << QVariant::fromValue(0U) << -1;
- QTest::newRow("float+uint3") << QVariant::fromValue(0.f) << QVariant::fromValue(1U) << -1;
- QTest::newRow("double+uint3") << QVariant::fromValue(0.) << QVariant::fromValue(1U) << -1;
- QTest::newRow("float+uint4") << QVariant::fromValue(1.5f) << QVariant::fromValue(1U) << +1;
- QTest::newRow("double+uint4") << QVariant::fromValue(1.5) << QVariant::fromValue(1U) << +1;
-
- // lower ranked + int
- QTest::newRow("bool+int1") << QVariant::fromValue(false) << QVariant::fromValue(0) << 0;
- QTest::newRow("bool+int2") << QVariant::fromValue(false) << QVariant::fromValue(1) << -1;
- QTest::newRow("bool+int3") << QVariant::fromValue(true) << QVariant::fromValue(0) << +1;
- QTest::newRow("bool+int4") << QVariant::fromValue(true) << QVariant::fromValue(1) << 0;
- QTest::newRow("bool+int5") << QVariant::fromValue(true) << QVariant::fromValue(2) << -1;
-
- QTest::newRow("char+int1") << QVariant::fromValue(char(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("char+int2") << QVariant::fromValue(char(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("char+int3") << QVariant::fromValue(char(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("char+int4") << QVariant::fromValue(char(1)) << QVariant::fromValue(1) << 0;
- if (std::numeric_limits<char>::is_signed) {
- QTest::newRow("char+int5") << QVariant::fromValue(char(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("char+int6") << QVariant::fromValue(char(-1)) << QVariant::fromValue(-1) << 0;
- }
-
- QTest::newRow("schar+int1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("schar+int2") << QVariant::fromValue(schar(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("schar+int3") << QVariant::fromValue(schar(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("schar+int4") << QVariant::fromValue(schar(1)) << QVariant::fromValue(1) << 0;
- QTest::newRow("schar+int5") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("schar+int6") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(-1) << 0;
-
- QTest::newRow("uchar+int1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("uchar+int2") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("uchar+int3") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("uchar+int4") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(1) << 0;
-
- QTest::newRow("short+int1") << QVariant::fromValue(short(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("short+int2") << QVariant::fromValue(short(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("short+int3") << QVariant::fromValue(short(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("short+int4") << QVariant::fromValue(short(1)) << QVariant::fromValue(1) << 0;
- QTest::newRow("short+int5") << QVariant::fromValue(short(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("short+int6") << QVariant::fromValue(short(-1)) << QVariant::fromValue(-1) << 0;
-
- QTest::newRow("ushort+int1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("ushort+int2") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("ushort+int3") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("ushort+int4") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(1) << 0;
-
- // lower ranked + uint (without sign change)
- QTest::newRow("bool+uint1") << QVariant::fromValue(false) << QVariant::fromValue(0U) << 0;
- QTest::newRow("bool+uint2") << QVariant::fromValue(false) << QVariant::fromValue(1U) << -1;
- QTest::newRow("bool+uint3") << QVariant::fromValue(true) << QVariant::fromValue(0U) << +1;
- QTest::newRow("bool+uint4") << QVariant::fromValue(true) << QVariant::fromValue(1U) << 0;
- QTest::newRow("bool+uint5") << QVariant::fromValue(true) << QVariant::fromValue(2U) << -1;
-
- QTest::newRow("char+uint1") << QVariant::fromValue(char(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("char+uint2") << QVariant::fromValue(char(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("char+uint3") << QVariant::fromValue(char(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("char+uint4") << QVariant::fromValue(char(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("schar+uint1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("schar+uint2") << QVariant::fromValue(schar(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("schar+uint3") << QVariant::fromValue(schar(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("schar+uint4") << QVariant::fromValue(schar(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("uchar+uint1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("uchar+uint2") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("uchar+uint3") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("uchar+uint4") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("short+uint1") << QVariant::fromValue(short(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("short+uint2") << QVariant::fromValue(short(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("short+uint3") << QVariant::fromValue(short(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("short+uint4") << QVariant::fromValue(short(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("ushort+uint1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("ushort+uint2") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("ushort+uint3") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("ushort+uint4") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(1U) << 0;
-
- // int + qlonglong
- QTest::newRow("int+qlonglong1") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(0)) << 0;
- QTest::newRow("int+qlonglong2") << QVariant::fromValue(1) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("int+qlonglong3") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(1)) << -1;
- QTest::newRow("int+qlonglong4") << QVariant::fromValue(1) << QVariant::fromValue(Q_INT64_C(1)) << 0;
- QTest::newRow("int+qlonglong5") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(-1)) << +1;
- QTest::newRow("int+qlonglong6") << QVariant::fromValue(-1) << QVariant::fromValue(Q_INT64_C(0)) << -1;
- QTest::newRow("int+qlonglong7") << QVariant::fromValue(-1) << QVariant::fromValue(Q_INT64_C(-1)) << 0;
-
- // uint + qulonglong
- QTest::newRow("uint+qulonglong1") << QVariant::fromValue(0U) << QVariant::fromValue(Q_UINT64_C(0)) << 0;
- QTest::newRow("uint+qulonglong2") << QVariant::fromValue(1U) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("uint+qulonglong3") << QVariant::fromValue(0U) << QVariant::fromValue(Q_UINT64_C(1)) << -1;
- QTest::newRow("uint+qulonglong4") << QVariant::fromValue(1U) << QVariant::fromValue(Q_UINT64_C(1)) << 0;
-
- // int + uint (without sign change)
- QTest::newRow("int+uint1") << QVariant::fromValue(0) << QVariant::fromValue(0U) << 0;
- QTest::newRow("int+uint2") << QVariant::fromValue(1) << QVariant::fromValue(0U) << +1;
- QTest::newRow("int+uint3") << QVariant::fromValue(0) << QVariant::fromValue(1U) << -1;
- QTest::newRow("int+uint4") << QVariant::fromValue(1) << QVariant::fromValue(1U) << 0;
-
- // uint + qlonglong
- QTest::newRow("uint+qlonglong1") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(0)) << 0;
- QTest::newRow("uint+qlonglong2") << QVariant::fromValue(1U) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("uint+qlonglong3") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(1)) << -1;
- QTest::newRow("uint+qlonglong4") << QVariant::fromValue(1U) << QVariant::fromValue(Q_INT64_C(1)) << 0;
- QTest::newRow("uint+qlonglong5") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(-1)) << +1;
-
- // boundary conditions
- QTest::newRow("charmax+intmax") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("charmax+uintmax") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("scharmax+intmax") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("scharmax+uintmax") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("ucharmax+intmax") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("ucharmax+uintmax") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("shortmax+intmax") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("shortmax+uintmax") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("ushortmax+intmax") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("ushortmax+uintmax") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
-
- QTest::newRow("intmin+qlonglongmin") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(LLONG_MIN) << +1;
- QTest::newRow("intmax+uintmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("intmax+qlonglongmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("uintmax+qlonglongmax") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("intmax+qulonglongmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("qlonglongmax+qulonglongmax") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("uintmax+qlonglongmin") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(LLONG_MIN) << +1;
-
- // check for no sign-extension issues
- QTest::newRow("ushortmax+intzero") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(0) << +1;
- QTest::newRow("ushortmax+qlonglongzero") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("uintmax+qlonglongzero") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(Q_INT64_C(0)) << +1;
-
- // sign changes
- // the tests below check that a signed negative number sign-changes to a non-zero unsigned number and that
- // signed -1 sign-changes to unsigned maximum (all bits set, ~0). This works on two's complement machines
- // (all that Qt supports), and would also work on one's complement.
- if (std::numeric_limits<char>::is_signed) {
- QTest::newRow("signchange-char+uint") << QVariant::fromValue(char(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-char+uintmax") << QVariant::fromValue(char(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-charmin+uint") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-char+qulonglong") << QVariant::fromValue(char(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-char+qulonglongmax") << QVariant::fromValue(char(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-charmin+qulonglong") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- }
- QTest::newRow("signchange-schar+uint") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-schar+uintmax") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-scharmin+uint") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-schar+qulonglong") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-schar+qulonglongmax") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-scharmin+qulonglong") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-short+uint") << QVariant::fromValue(short(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-short+uintmax") << QVariant::fromValue(short(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-shortmin+uint") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-short+qulonglong") << QVariant::fromValue(short(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-short+qulonglongmax") << QVariant::fromValue(short(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-shortmin+qulonglong") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-int+uint") << QVariant::fromValue(-1) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-int+uintmax") << QVariant::fromValue(-1) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-intmin+uint") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-int+qulonglong") << QVariant::fromValue(-1) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-int+qulonglongmax") << QVariant::fromValue(-1) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-intmin+qulonglong") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- // no qlonglong+uint, since that should promote to qlonglong and then the comparison is signed (tested above)
- QTest::newRow("signchange-qlonglong+qulonglong") << QVariant::fromValue(Q_INT64_C(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-qlonglong+qulonglongmax") << QVariant::fromValue(Q_INT64_C(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-qlonglongmin+qulonglong") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
-}
-
-void tst_QVariant::compareNumbers() const
-{
- QFETCH(QVariant, v1);
- QFETCH(QVariant, v2);
- QFETCH(int, expected);
-
- if (expected == -1) {
- QVERIFY(v1 < v2);
- QVERIFY(v1 <= v2);
- QVERIFY(!(v1 == v2));
- QVERIFY(!(v1 > v2));
- QVERIFY(!(v1 >= v2));
-
- QVERIFY(!(v2 < v1));
- QVERIFY(!(v2 <= v1));
- QVERIFY(!(v2 == v1));
- QVERIFY(v2 >= v1);
- QVERIFY(v2 > v1);
- } else if (expected == 0) {
- QVERIFY(!(v1 < v2));
- QVERIFY(v1 <= v2);
- QCOMPARE(v1, v2);
- QVERIFY(!(v1 > v2));
- QVERIFY(v1 >= v2);
-
- QVERIFY(!(v2 < v1));
- QVERIFY(v2 <= v1);
- QCOMPARE(v2, v1);
- QVERIFY(v2 >= v1);
- QVERIFY(!(v2 > v1));
- } else if (expected == +1) {
- QVERIFY(!(v1 < v2));
- QVERIFY(!(v1 <= v2));
- QVERIFY(!(v1 == v2));
- QVERIFY(v1 > v2);
- QVERIFY(v1 >= v2);
-
- QVERIFY(v2 < v1);
- QVERIFY(v2 <= v1);
- QVERIFY(!(v2 == v1));
- QVERIFY(!(v2 >= v1));
- QVERIFY(!(v2 > v1));
- } else {
- // unorderable (NaN)
- QVERIFY(!(v1 == v2));
- }
-}
-
void tst_QVariant::typeName_data()
{
QTest::addColumn<int>("type");
@@ -3957,8 +3614,7 @@ Q_DECLARE_METATYPE(Convertible);
struct BigConvertible {
double d;
- double dummy;
- double dummy2;
+ double dummy[sizeof(QVariant) / sizeof(double)];
operator int() const { return (int)d; }
operator double() const { return d; }
operator QString() const { return QString::number(d); }
@@ -4859,86 +4515,6 @@ void tst_QVariant::metaEnums()
METAENUMS_TEST(MetaEnumTest_Enum8_value);
}
-void tst_QVariant::compareSanity_data()
-{
- QTest::addColumn<QVariant>("value1");
- QTest::addColumn<QVariant>("value2");
-
- QTest::newRow( "int <>/== QUrl" ) << QVariant( 97 ) << QVariant(QUrl("a"));
- QTest::newRow( "int <>/== QChar" ) << QVariant( 97 ) << QVariant(QChar('a'));
- QTest::newRow( "int <>/== QString" ) << QVariant( 97 ) << QVariant(QString("a"));
- QTest::newRow( "QUrl <>/== QChar" ) << QVariant(QUrl("a")) << QVariant(QChar('a'));
- QTest::newRow( "QUrl <>/== QString" ) << QVariant(QUrl("a")) << QVariant(QString("a"));
- QTest::newRow( "QChar <>/== QString" ) << QVariant(QChar('a')) << QVariant(QString("a"));
-}
-
-void tst_QVariant::compareSanity()
-{
- QFETCH(QVariant, value1);
- QFETCH(QVariant, value2);
-
- if (value1 == value2) {
- QVERIFY(!(value1 < value2) && !(value1 > value2));
- } else {
- QVERIFY(value1 != value2);
- QVERIFY((value1 < value2) || (value1 > value2));
- }
-}
-
-static void richComparison(const QVariant& less, const QVariant& more)
-{
- QVERIFY(less.type() == more.type());
-
- QVERIFY(less < more);
- QVERIFY(!(more < less));
-
- QVERIFY(more > less);
- QVERIFY(!(less > more));
-
- QVERIFY(less <= more);
- QVERIFY(!(more <= less));
- QVERIFY(less <= less);
-
- QVERIFY(more >= less);
- QVERIFY(!(less >= more));
- QVERIFY(more >= more);
-}
-
-void tst_QVariant::compareRich()
-{
- richComparison(QUuid("{49d8ad2a-2ee8-4c3d-949f-1b5a3765ddf0}"),
- QUuid("{f6d56824-16e9-4543-a375-add2877c2d05}"));
- richComparison(QByteArray::fromRawData("a", 1),
- QByteArray::fromRawData("b", 1));
- richComparison(QStringLiteral("a"), QStringLiteral("b"));
- richComparison(QLatin1String("a"), QLatin1String("b"));
- richComparison(QChar('a'), QChar('b'));
- richComparison(QDate(2016, 7, 23), QDate(2016, 7, 24));
- richComparison(QTime(0, 0), QTime(0, 1));
- richComparison(QDateTime(QDate(2016, 7, 23), QTime(0, 0)),
- QDateTime(QDate(2016, 7, 23), QTime(0, 1)));
-
- richComparison(QStringList(), QStringList() << QStringLiteral("a"));
- richComparison(QStringList(), QStringList() << QStringLiteral("a")
- << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a"),
- QStringList() << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a"),
- QStringList() << QStringLiteral("b")
- << QStringLiteral("c"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("b")
- << QStringLiteral("d"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("a")
- << QStringLiteral("d"));
-}
-
void tst_QVariant::nullConvert()
{
// Test quirks with QVariants different types of null states.
diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
index 57aa67c142..50d3ab1f6b 100644
--- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
@@ -52,6 +52,8 @@ private Q_SLOTS:
void testNumbers_3();
void testNumbers_4();
+ void testNumberComparisons();
+
void testObjectSimple();
void testObjectSmallKeys();
void testArraySimple();
@@ -218,26 +220,32 @@ void tst_QtJson::testNumbers()
{
int numbers[] = {
0,
- -1,
1,
+ 2,
+ -1,
+ -2,
+ (1<<25),
(1<<26),
(1<<27),
(1<<28),
+ -(1<<25),
-(1<<26),
-(1<<27),
-(1<<28),
(1<<26) - 1,
(1<<27) - 1,
(1<<28) - 1,
+ (1<<29) - 1,
-((1<<26) - 1),
-((1<<27) - 1),
- -((1<<28) - 1)
+ -((1<<28) - 1),
+ -((1<<29) - 1)
};
int n = sizeof(numbers)/sizeof(int);
QJsonArray array;
for (int i = 0; i < n; ++i)
- array.append((double)numbers[i]);
+ array.append(numbers[i]);
QByteArray serialized = QJsonDocument(array).toJson();
QJsonDocument json = QJsonDocument::fromJson(serialized);
@@ -246,8 +254,10 @@ void tst_QtJson::testNumbers()
QCOMPARE(array.size(), array2.size());
for (int i = 0; i < array.size(); ++i) {
QCOMPARE(array.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array.at(i).toInt(), numbers[i]);
QCOMPARE(array.at(i).toDouble(), (double)numbers[i]);
QCOMPARE(array2.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array2.at(i).toInt(), numbers[i]);
QCOMPARE(array2.at(i).toDouble(), (double)numbers[i]);
}
}
@@ -255,8 +265,10 @@ void tst_QtJson::testNumbers()
{
qint64 numbers[] = {
0,
- -1,
1,
+ 2,
+ -1,
+ -2,
(1ll<<54),
(1ll<<55),
(1ll<<56),
@@ -266,15 +278,21 @@ void tst_QtJson::testNumbers()
(1ll<<54) - 1,
(1ll<<55) - 1,
(1ll<<56) - 1,
+ (1ll<<57) - 1,
+ (1ll<<58) - 1,
+ (1ll<<59) + 1001,
-((1ll<<54) - 1),
-((1ll<<55) - 1),
- -((1ll<<56) - 1)
+ -((1ll<<56) - 1),
+ -((1ll<<57) - 1),
+ -((1ll<<58) - 1),
+ -((1ll<<59) + 1001),
};
int n = sizeof(numbers)/sizeof(qint64);
QJsonArray array;
for (int i = 0; i < n; ++i)
- array.append((double)numbers[i]);
+ array.append(QJsonValue(numbers[i]));
QByteArray serialized = QJsonDocument(array).toJson();
QJsonDocument json = QJsonDocument::fromJson(serialized);
@@ -283,8 +301,10 @@ void tst_QtJson::testNumbers()
QCOMPARE(array.size(), array2.size());
for (int i = 0; i < array.size(); ++i) {
QCOMPARE(array.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array.at(i).toInteger(), numbers[i]);
QCOMPARE(array.at(i).toDouble(), (double)numbers[i]);
QCOMPARE(array2.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array2.at(i).toInteger(), numbers[i]);
QCOMPARE(array2.at(i).toDouble(), (double)numbers[i]);
}
}
@@ -422,6 +442,46 @@ void tst_QtJson::testNumbers_4()
" -18446744073709552000\n"
"]\n";
QCOMPARE(json, expected);
+
+ QJsonArray array2;
+ array2 << QJsonValue(Q_INT64_C(+1000000000000000));
+ array2 << QJsonValue(Q_INT64_C(-1000000000000000));
+ array2 << QJsonValue(Q_INT64_C(+9007199254740992));
+ array2 << QJsonValue(Q_INT64_C(-9007199254740992));
+ array2 << QJsonValue(Q_INT64_C(+9223372036854775807));
+ array2 << QJsonValue(Q_INT64_C(-9223372036854775807));
+ const QByteArray json2(QJsonDocument(array2).toJson());
+ const QByteArray expected2 =
+ "[\n"
+ " 1000000000000000,\n"
+ " -1000000000000000,\n"
+ " 9007199254740992,\n"
+ " -9007199254740992,\n"
+ " 9223372036854775807,\n"
+ " -9223372036854775807\n"
+ "]\n";
+ QCOMPARE(json2, expected2);
+}
+
+void tst_QtJson::testNumberComparisons()
+{
+ // QJsonValues created using doubles only have double precision
+ QJsonValue llMinDbl(-9223372036854775807.0);
+ QJsonValue llMinPlus1Dbl(-9223372036854775806.0);
+ QCOMPARE(llMinDbl == llMinPlus1Dbl, -9223372036854775807.0 == -9223372036854775806.0); // true
+
+ // QJsonValues created using qint64 have full qint64 precision
+ QJsonValue llMin(Q_INT64_C(-9223372036854775807));
+ QJsonValue llMinPlus1(Q_INT64_C(-9223372036854775806));
+ QCOMPARE(llMin == llMinPlus1, Q_INT64_C(-9223372036854775807) == Q_INT64_C(-9223372036854775806)); // false
+
+ // The different storage formats should be able to compare as their C++ versions (all true)
+ QCOMPARE(llMin == llMinDbl, Q_INT64_C(-9223372036854775807) == -9223372036854775807.0);
+ QCOMPARE(llMinDbl == llMin, -9223372036854775807.0 == Q_INT64_C(-9223372036854775807));
+ QCOMPARE(llMinPlus1 == llMinPlus1Dbl, Q_INT64_C(-9223372036854775806) == -9223372036854775806.0);
+ QCOMPARE(llMinPlus1Dbl == llMinPlus1, -9223372036854775806.0 == Q_INT64_C(-9223372036854775806));
+ QCOMPARE(llMinPlus1 == llMinDbl, Q_INT64_C(-9223372036854775806) == -9223372036854775807.0);
+ QCOMPARE(llMinPlus1Dbl == llMin, -9223372036854775806.0 == Q_INT64_C(-9223372036854775807));
}
void tst_QtJson::testObjectSimple()
@@ -1160,8 +1220,8 @@ void tst_QtJson::fromVariant_data()
bool boolValue = true;
int intValue = -1;
uint uintValue = 1;
- long long longlongValue = -2;
- unsigned long long ulonglongValue = 2;
+ qlonglong longlongValue = -2;
+ qulonglong ulonglongValue = 2;
float floatValue = 3.3f;
double doubleValue = 4.4;
QString stringValue("str");
@@ -1207,7 +1267,7 @@ void tst_QtJson::fromVariant_data()
QTest::newRow("nullptr") << QVariant::fromValue(nullptr) << QJsonValue(QJsonValue::Null);
QTest::newRow("bool") << QVariant(boolValue) << QJsonValue(boolValue);
QTest::newRow("int") << QVariant(intValue) << QJsonValue(intValue);
- QTest::newRow("uint") << QVariant(uintValue) << QJsonValue(static_cast<double>(uintValue));
+ QTest::newRow("uint") << QVariant(uintValue) << QJsonValue(static_cast<qint64>(uintValue));
QTest::newRow("longlong") << QVariant(longlongValue) << QJsonValue(longlongValue);
QTest::newRow("ulonglong") << QVariant(ulonglongValue) << QJsonValue(static_cast<double>(ulonglongValue));
QTest::newRow("float") << QVariant(floatValue) << QJsonValue(floatValue);
diff --git a/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp b/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
index 56245a7173..76f2bb924a 100644
--- a/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
@@ -97,9 +97,12 @@ void tst_QCborValue_Json::toVariant_data()
add(1, 1, 1);
add(-1, -1, -1);
add(0., 0., 0.);
+ add(2., 2., 2.);
add(1.25, 1.25, 1.25);
add(-1.25, -1.25, -1.25);
add("Hello", "Hello", "Hello");
+ add(std::numeric_limits<qint64>::max(), std::numeric_limits<qint64>::max(), std::numeric_limits<qint64>::max());
+ add(std::numeric_limits<qint64>::min(), std::numeric_limits<qint64>::min(), std::numeric_limits<qint64>::min());
// converts to string in JSON:
add(QByteArray("Hello"), QByteArray("Hello"), "SGVsbG8");
@@ -123,14 +126,6 @@ void tst_QCborValue_Json::toVariant_data()
<< QVariant(qQNaN())
<< QJsonValue();
- // large integral values lose precision in JSON
- QTest::newRow("Integer:max") << QCborValue(std::numeric_limits<qint64>::max())
- << QVariant(std::numeric_limits<qint64>::max())
- << QJsonValue(std::numeric_limits<qint64>::max());
- QTest::newRow("Integer:min") << QCborValue(std::numeric_limits<qint64>::min())
- << QVariant(std::numeric_limits<qint64>::min())
- << QJsonValue(std::numeric_limits<qint64>::min());
-
// empty arrays and maps
add(QCborArray(), QVariantList(), QJsonArray());
add(QCborMap(), QVariantMap(), QJsonObject());
@@ -257,6 +252,10 @@ void tst_QCborValue_Json::fromJson_data()
QTest::newRow("0") << QCborValue(0) << QJsonValue(0.);
QTest::newRow("1") << QCborValue(1) << QJsonValue(1);
QTest::newRow("1.5") << QCborValue(1.5) << QJsonValue(1.5);
+ QTest::newRow("Integer:max") << QCborValue(std::numeric_limits<qint64>::max())
+ << QJsonValue(std::numeric_limits<qint64>::max());
+ QTest::newRow("Integer:min") << QCborValue(std::numeric_limits<qint64>::min())
+ << QJsonValue(std::numeric_limits<qint64>::min());
QTest::newRow("string") << QCborValue("Hello") << QJsonValue("Hello");
QTest::newRow("array") << QCborValue(QCborValue::Array) << QJsonValue(QJsonValue::Array);
QTest::newRow("map") << QCborValue(QCborValue::Map) << QJsonValue(QJsonValue::Object);
diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
index 8197c386c5..d402e3f63b 100644
--- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
@@ -2327,6 +2327,7 @@ void tst_QDataStream::setVersion()
QDataStream latest;
QFETCH(int, vers);
+#if QT_CONFIG(shortcut)
/*
Test QKeySequence.
*/
@@ -2351,6 +2352,7 @@ void tst_QDataStream::setVersion()
}
QCOMPARE(deadbeef, 0xDEADBEEF);
}
+#endif // QT_CONFIG(shortcut)
/*
Test QPalette.
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index 48dd7a241e..e3009a78fb 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -149,36 +149,17 @@ private slots:
void stdString();
};
-static const struct StaticByteArrays {
- struct Standard {
- QByteArrayData data;
- const char string[8];
- } standard;
- struct NotNullTerminated {
- QByteArrayData data;
- const char string[8];
- } notNullTerminated;
- struct Shifted {
- QByteArrayData data;
- const char dummy; // added to change offset of string
- const char string[8];
- } shifted;
- struct ShiftedNotNullTerminated {
- QByteArrayData data;
- const char dummy; // added to change offset of string
- const char string[8];
- } shiftedNotNullTerminated;
-
-} statics = {{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "data"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "dataBAD"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "data"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "dataBAD"}
- };
-
-static const QByteArrayDataPtr staticStandard = { const_cast<QByteArrayData *>(&statics.standard.data) };
-static const QByteArrayDataPtr staticNotNullTerminated = { const_cast<QByteArrayData *>(&statics.notNullTerminated.data) };
-static const QByteArrayDataPtr staticShifted = { const_cast<QByteArrayData *>(&statics.shifted.data) };
-static const QByteArrayDataPtr staticShiftedNotNullTerminated = { const_cast<QByteArrayData *>(&statics.shiftedNotNullTerminated.data) };
+static const QArrayData staticDataFlags = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
+static const QByteArray::DataPointer staticStandard = {
+ static_cast<QTypedArrayData<char> *>(const_cast<QArrayData *>(&staticDataFlags)),
+ const_cast<char *>("data"),
+ 4
+};
+static const QByteArray::DataPointer staticNotNullTerminated = {
+ static_cast<QTypedArrayData<char> *>(const_cast<QArrayData *>(&staticDataFlags)),
+ const_cast<char *>("dataBAD"),
+ 4
+};
template <class T> const T &verifyZeroTermination(const T &t) { return t; }
@@ -186,11 +167,10 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
{
// This test does some evil stuff, it's all supposed to work.
- QByteArray::DataPtr baDataPtr = const_cast<QByteArray &>(ba).data_ptr();
+ QByteArray::DataPointer baDataPtr = const_cast<QByteArray &>(ba).data_ptr();
// Skip if isStatic() or fromRawData(), as those offer no guarantees
- if (baDataPtr->ref.isStatic()
- || baDataPtr->offset != QByteArray().data_ptr()->offset)
+ if (baDataPtr->isStatic() || baDataPtr->flags() & QArrayData::RawDataType)
return ba;
int baSize = ba.size();
@@ -201,7 +181,7 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
.arg(baTerminator, 2, 16, QChar('0')).toLatin1();
// Skip mutating checks on shared strings
- if (baDataPtr->ref.isShared())
+ if (baDataPtr->isShared())
return ba;
const char *baData = ba.constData();
@@ -253,11 +233,11 @@ void tst_QByteArray::qChecksum_data()
QTest::addColumn<uint>("checksum");
// Examples from ISO 14443-3
- QTest::newRow("1") << QByteArray("\x00\x00") << 2U << Qt::ChecksumItuV41 << 0x1EA0U;
- QTest::newRow("2") << QByteArray("\x12\x34") << 2U << Qt::ChecksumItuV41 << 0xCF26U;
- QTest::newRow("3") << QByteArray("\x00\x00\x00") << 3U << Qt::ChecksumIso3309 << 0xC6CCU;
- QTest::newRow("4") << QByteArray("\x0F\xAA\xFF") << 3U << Qt::ChecksumIso3309 << 0xD1FCU;
- QTest::newRow("5") << QByteArray("\x0A\x12\x34\x56") << 4U << Qt::ChecksumIso3309 << 0xF62CU;
+ QTest::newRow("1") << QByteArray("\x00\x00", 2) << 2U << Qt::ChecksumItuV41 << 0x1EA0U;
+ QTest::newRow("2") << QByteArray("\x12\x34", 2) << 2U << Qt::ChecksumItuV41 << 0xCF26U;
+ QTest::newRow("3") << QByteArray("\x00\x00\x00", 3) << 3U << Qt::ChecksumIso3309 << 0xC6CCU;
+ QTest::newRow("4") << QByteArray("\x0F\xAA\xFF", 3) << 3U << Qt::ChecksumIso3309 << 0xD1FCU;
+ QTest::newRow("5") << QByteArray("\x0A\x12\x34\x56", 4) << 4U << Qt::ChecksumIso3309 << 0xF62CU;
}
void tst_QByteArray::qChecksum()
@@ -267,6 +247,7 @@ void tst_QByteArray::qChecksum()
QFETCH(Qt::ChecksumType, standard);
QFETCH(uint, checksum);
+ QCOMPARE(data.length(), int(len));
if (standard == Qt::ChecksumIso3309) {
QCOMPARE(::qChecksum(data.constData(), len), static_cast<quint16>(checksum));
}
@@ -1054,9 +1035,7 @@ void tst_QByteArray::prependExtended_data()
QTest::addColumn<QByteArray>("array");
QTest::newRow("literal") << QByteArray(QByteArrayLiteral("data"));
QTest::newRow("standard") << QByteArray(staticStandard);
- QTest::newRow("shifted") << QByteArray(staticShifted);
QTest::newRow("notNullTerminated") << QByteArray(staticNotNullTerminated);
- QTest::newRow("shiftedNotNullTerminated") << QByteArray(staticShiftedNotNullTerminated);
QTest::newRow("non static data") << QByteArray("data");
QTest::newRow("from raw data") << QByteArray::fromRawData("data", 4);
QTest::newRow("from raw data not terminated") << QByteArray::fromRawData("dataBAD", 4);
@@ -2122,21 +2101,13 @@ void tst_QByteArray::repeated_data() const
<< QByteArray(staticStandard)
<< QByteArray("datadatadatadata")
<< 4;
- QTest::newRow("static shifted not null terminated")
- << QByteArray(staticShiftedNotNullTerminated)
- << QByteArray("datadatadatadata")
- << 4;
- QTest::newRow("static shifted")
- << QByteArray(staticShifted)
- << QByteArray("datadatadatadata")
- << 4;
}
void tst_QByteArray::byteRefDetaching() const
{
{
QByteArray str = "str";
- QByteArray copy;
+ QByteArray copy = str;
copy[0] = 'S';
QCOMPARE(str, QByteArray("str"));
@@ -2266,7 +2237,7 @@ void tst_QByteArray::movablity()
const int newSize = size + 2;
const bool newIsEmpty = false;
const bool newIsNull = false;
- const int newCapacity = 16;
+ const int newCapacity = memSpace.capacity();
// move back memSpace -> array
array.~QByteArray();
@@ -2301,8 +2272,7 @@ void tst_QByteArray::literals()
QVERIFY(str.length() == 4);
QVERIFY(str == "abcd");
- QVERIFY(str.data_ptr()->ref.isStatic());
- QVERIFY(str.data_ptr()->offset == sizeof(QByteArrayData));
+ QVERIFY(str.data_ptr()->isStatic());
const char *s = str.constData();
QByteArray str2 = str;
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 2108e99f20..d88f93b25a 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -605,11 +605,10 @@ QString verifyZeroTermination(const QString &str)
{
// This test does some evil stuff, it's all supposed to work.
- QString::DataPtr strDataPtr = const_cast<QString &>(str).data_ptr();
+ QString::DataPointer strDataPtr = const_cast<QString &>(str).data_ptr();
// Skip if isStatic() or fromRawData(), as those offer no guarantees
- if (strDataPtr->ref.isStatic()
- || strDataPtr->offset != QString().data_ptr()->offset)
+ if (strDataPtr.d->isStatic() || !strDataPtr.d->isMutable())
return str;
int strSize = str.size();
@@ -620,7 +619,7 @@ QString verifyZeroTermination(const QString &str)
.arg(strTerminator.unicode(), 4, 16, QChar('0'));
// Skip mutating checks on shared strings
- if (strDataPtr->ref.isShared())
+ if (strDataPtr.d->isShared())
return str;
const QChar *strData = str.constData();
@@ -984,28 +983,6 @@ void tst_QString::acc_01()
f[7]='F';
QCOMPARE(text[7],'!');
- a="";
- a[0]='A';
- QCOMPARE(a, QLatin1String("A"));
- QCOMPARE(a.length(),1);
- a[1]='B';
- QCOMPARE(a, QLatin1String("AB"));
- QCOMPARE(a.length(),2);
- a[2]='C';
- QCOMPARE(a, QLatin1String("ABC"));
- QCOMPARE(a.length(),3);
- a = QString();
- QVERIFY(a.isNull());
- a[0]='A';
- QCOMPARE(a, QLatin1String("A"));
- QCOMPARE(a.length(),1);
- a[1]='B';
- QCOMPARE(a, QLatin1String("AB"));
- QCOMPARE(a.length(),2);
- a[2]='C';
- QCOMPARE(a, QLatin1String("ABC"));
- QCOMPARE(a.length(),3);
-
a="123";
b="456";
a[0]=a[1];
@@ -4070,12 +4047,12 @@ void tst_QString::setRawData()
QVERIFY(cstr == QString(ptr, 1));
// This actually tests the recycling of the shared data object
- QString::DataPtr csd = cstr.data_ptr();
+ void *csd = cstr.data_ptr().d;
cstr.setRawData(ptr2, 1);
QVERIFY(cstr.isDetached());
QVERIFY(cstr.constData() == ptr2);
QVERIFY(cstr == QString(ptr2, 1));
- QVERIFY(cstr.data_ptr() == csd);
+ QVERIFY(cstr.data_ptr().d == csd);
// This tests the discarding of the shared data object
cstr = "foo";
@@ -4083,12 +4060,12 @@ void tst_QString::setRawData()
QVERIFY(cstr.constData() != ptr2);
// Another test of the fallback
- csd = cstr.data_ptr();
+ csd = cstr.data_ptr().d;
cstr.setRawData(ptr2, 1);
QVERIFY(cstr.isDetached());
QVERIFY(cstr.constData() == ptr2);
QVERIFY(cstr == QString(ptr2, 1));
- QVERIFY(cstr.data_ptr() != csd);
+ QVERIFY(cstr.data_ptr().d != csd);
}
void tst_QString::fromStdString()
@@ -6416,7 +6393,7 @@ void tst_QString::QCharRefDetaching() const
{
{
QString str = QString::fromLatin1("str");
- QString copy;
+ QString copy = str;
copy[0] = QLatin1Char('S');
QCOMPARE(str, QString::fromLatin1("str"));
@@ -6637,8 +6614,7 @@ void tst_QString::literals()
QVERIFY(str.length() == 4);
QVERIFY(str == QLatin1String("abcd"));
- QVERIFY(str.data_ptr()->ref.isStatic());
- QVERIFY(str.data_ptr()->offset == sizeof(QStringData));
+ QVERIFY(str.data_ptr().d->isStatic());
const QChar *s = str.constData();
QString str2 = str;
diff --git a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
index 6f01947131..20d5426bf7 100644
--- a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
@@ -87,6 +87,7 @@ private slots:
void mid();
void split_data();
void split();
+ void nullToString();
};
static QStringRef emptyRef()
@@ -2177,6 +2178,18 @@ void tst_QStringRef::split()
}
}
+void tst_QStringRef::nullToString()
+{
+ QStringRef nullRef;
+ QVERIFY(nullRef.isNull());
+ QVERIFY(nullRef.toString().isNull());
+
+ QString str;
+ nullRef = &str;
+ QVERIFY(nullRef.isNull());
+ QVERIFY(nullRef.toString().isNull());
+}
+
QTEST_APPLESS_MAIN(tst_QStringRef)
#include "tst_qstringref.moc"
diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
index bef491d5f0..22ee7d17b7 100644
--- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
+++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
@@ -237,28 +237,23 @@ template <typename T> struct TypeInStruct { T type; };
void tst_QAtomicInt::alignment()
{
-#ifdef Q_ALIGNOF
- // this will cause a build error if the alignment isn't the same
- char dummy1[Q_ALIGNOF(QBasicAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1];
- char dummy2[Q_ALIGNOF(QAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1];
- (void)dummy1; (void)dummy2;
+ Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
+ Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
#ifdef Q_ATOMIC_INT32_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<int>), Q_ALIGNOF(TypeInStruct<int>));
+ QCOMPARE(alignof(QBasicAtomicInteger<int>), alignof(TypeInStruct<int>));
#endif
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<short>), Q_ALIGNOF(TypeInStruct<short>));
+ QCOMPARE(alignof(QBasicAtomicInteger<short>), alignof(TypeInStruct<short>));
#endif
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<char>), Q_ALIGNOF(TypeInStruct<char>));
+ QCOMPARE(alignof(QBasicAtomicInteger<char>), alignof(TypeInStruct<char>));
#endif
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<qlonglong>), Q_ALIGNOF(TypeInStruct<qlonglong>));
-#endif
-
+ QCOMPARE(alignof(QBasicAtomicInteger<qlonglong>), alignof(TypeInStruct<qlonglong>));
#endif
}
diff --git a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
index a699cf6202..9e12e7ccce 100644
--- a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
+++ b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
@@ -108,11 +108,7 @@ void tst_QAtomicPointer::warningFree()
void tst_QAtomicPointer::alignment()
{
-#ifdef Q_ALIGNOF
- // this will cause a build error if the alignment isn't the same
- char dummy[Q_ALIGNOF(QBasicAtomicPointer<void>) == Q_ALIGNOF(void*) ? 1 : -1];
- (void)dummy;
-#endif
+ Q_STATIC_ASSERT(alignof(QBasicAtomicPointer<void>) == alignof(void*));
}
void tst_QAtomicPointer::constructor()
diff --git a/tests/auto/corelib/thread/qfuture/qfuture.pro b/tests/auto/corelib/thread/qfuture/qfuture.pro
index 1f21130af7..fe097edf20 100644
--- a/tests/auto/corelib/thread/qfuture/qfuture.pro
+++ b/tests/auto/corelib/thread/qfuture/qfuture.pro
@@ -2,5 +2,4 @@ CONFIG += testcase
TARGET = tst_qfuture
QT = core core-private testlib
SOURCES = tst_qfuture.cpp
-DEFINES += QT_STRICT_ITERATORS
DEFINES -= QT_NO_JAVA_STYLE_ITERATORS
diff --git a/tests/auto/corelib/thread/qresultstore/qresultstore.pro b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
index bbebe0976b..80e79b1c1a 100644
--- a/tests/auto/corelib/thread/qresultstore/qresultstore.pro
+++ b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qresultstore
QT = core-private testlib
SOURCES = tst_qresultstore.cpp
-DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro
index e0f9f0a0ea..d5e4e226b5 100644
--- a/tests/auto/corelib/tools/collections/collections.pro
+++ b/tests/auto/corelib/tools/collections/collections.pro
@@ -5,5 +5,4 @@ QT = core testlib
# This test does not work with strict iterators
DEFINES -= QT_NO_LINKED_LIST
-DEFINES -= QT_STRICT_ITERATORS
DEFINES -= QT_NO_JAVA_STYLE_ITERATORS
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index e79a4dba29..023b22b4ba 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -84,10 +84,6 @@ void foo()
#include "qvector.h"
#include "qqueue.h"
-QT_BEGIN_NAMESPACE
-template class QList<int>;
-QT_END_NAMESPACE
-
class tst_Collections : public QObject
{
Q_OBJECT
@@ -551,19 +547,12 @@ void tst_Collections::list()
list << "foo" << "bar";
QVERIFY(!list.isEmpty());
- list.insert(-1, "lessthanzero");
- QCOMPARE(list.at(0), QString("lessthanzero"));
-
list.insert(0, "atzero");
QCOMPARE(list.at(0), QString("atzero"));
int listCount = list.count();
list.insert(listCount, "atcount");
QCOMPARE(list.at(listCount), QString("atcount"));
-
- listCount = list.count();
- list.insert(listCount + 1, "beyondcount");
- QCOMPARE(list.at(listCount), QString("beyondcount"));
}
{
@@ -2337,12 +2326,6 @@ void populate(QLinkedList<int> &container)
}
template <>
-void populate(QVector<int> &container)
-{
- container << 1 << 2 << 4 << 8;
-}
-
-template <>
void populate(QMap<int, int> &container)
{
container.insert(1, 1);
@@ -3214,9 +3197,7 @@ void tst_Collections::forwardDeclared()
{ typedef QSet<T1> C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) }
}
-#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN)
-
-class Q_DECL_ALIGN(4) Aligned4
+class alignas(4) Aligned4
{
char i;
public:
@@ -3228,7 +3209,7 @@ public:
inline bool operator<(const Aligned4 &other) const { return i < other.i; }
friend inline int qHash(const Aligned4 &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(Q_ALIGNOF(Aligned4) % 4 == 0);
+Q_STATIC_ASSERT(alignof(Aligned4) % 4 == 0);
#if defined(Q_PROCESSOR_ARM)
# if defined(Q_COMPILER_ALIGNAS) && defined(__BIGGEST_ALIGNMENT__)
@@ -3242,7 +3223,7 @@ Q_STATIC_ASSERT(Q_ALIGNOF(Aligned4) % 4 == 0);
# define BIGGEST_ALIGNMENT_TO_TEST 128
#endif
-class Q_DECL_ALIGN(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest
+class alignas(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest
{
char i;
public:
@@ -3254,7 +3235,7 @@ public:
inline bool operator<(const AlignedBiggest &other) const { return i < other.i; }
friend inline int qHash(const AlignedBiggest &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(Q_ALIGNOF(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
+Q_STATIC_ASSERT(alignof(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
template<typename C>
void testVectorAlignment()
@@ -3325,13 +3306,6 @@ void tst_Collections::alignment()
testAssociativeContainerAlignment<QHash<AlignedBiggest, AlignedBiggest> >();
}
-#else
-void tst_Collections::alignment()
-{
- QSKIP("Compiler doesn't support necessary extension keywords");
-}
-#endif
-
#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
template<template<class> class C>
@@ -3510,9 +3484,6 @@ void tst_Collections::foreach_2()
QCOMPARE(varl1.count(), intlist.count());
QCOMPARE(varl2.count(), intlist.count());
QCOMPARE(varl3.count(), intlist.count());
- foreach_test_arrays(varl1);
- foreach_test_arrays(varl2);
- foreach_test_arrays(varl3);
QVarLengthArray<QString> varl4;
QVarLengthArray<QString, 3> varl5;
@@ -3525,9 +3496,6 @@ void tst_Collections::foreach_2()
QCOMPARE(varl4.count(), strlist.count());
QCOMPARE(varl5.count(), strlist.count());
QCOMPARE(varl6.count(), strlist.count());
- foreach_test_arrays(varl4);
- foreach_test_arrays(varl5);
- foreach_test_arrays(varl6);
}
struct IntOrString
@@ -3615,30 +3583,8 @@ template<class Container> void insert_remove_loop_impl()
}
-//Add insert(int, int, T) so it has the same interface as QVector and QVarLengthArray for the test.
template<typename T>
-struct ExtList : QList<T> {
- using QList<T>::insert;
- void insert(int before, int n, const T&x) {
- while (n--) {
- this->insert(before, x );
- }
- }
- void insert(typename QList<T>::iterator before, int n, const T&x) {
- while (n--) {
- before = this->insert(before, x);
- }
- }
-
- void remove(int i) {
- this->removeAt(i);
- }
- void remove(int i, int n) {
- while (n--) {
- this->removeAt(i);
- }
- }
-};
+using ExtList = QList<T>;
void tst_Collections::insert_remove_loop()
{
diff --git a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
index e46d51761e..efdb7fc2df 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
+++ b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
@@ -3,6 +3,4 @@ TARGET = tst_containerapisymmetry
SOURCES += tst_containerapisymmetry.cpp
QT = core testlib
-# This test does not work with strict iterators
-DEFINES -= QT_STRICT_ITERATORS
DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
index 4b085d387d..f6f10e9642 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -580,9 +580,6 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<VarLengthArray<T...>> : ContainerAcceptsDuplicateValues {};
template<typename ... T>
-struct ContainerDuplicatedValuesStrategy<QList<T...>> : ContainerAcceptsDuplicateValues {};
-
-template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::list<T...>> : ContainerAcceptsDuplicateValues {};
#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>)
@@ -798,8 +795,6 @@ template <> QStringView make(int size) { return QStringView(s_string).left(siz
template <> QLatin1String make(int size) { return QLatin1String("\1\2\3\4\5\6\7", size); }
template <typename T> T clean(T &&t) { return std::forward<T>(t); }
-inline QChar clean(QCharRef ch) { return ch; }
-inline char clean(QByteRef ch) { return ch; }
inline char clean(QLatin1Char ch) { return ch.toLatin1(); }
template <typename Container>
diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h
index 9dd8b05796..94cee5d887 100644
--- a/tests/auto/corelib/tools/qarraydata/simplevector.h
+++ b/tests/auto/corelib/tools/qarraydata/simplevector.h
@@ -76,25 +76,32 @@ public:
{
}
- explicit SimpleVector(Data *ptr)
- : d(ptr)
+ template <size_t N>
+ explicit SimpleVector(QStaticArrayData<T, N> &ptr)
+ : d(static_cast<Data *>(&ptr.header), ptr.data, N)
+ {
+ }
+
+ SimpleVector(Data *header, T *data, size_t len = 0)
+ : d(header, data, len)
+ {
+ }
+
+ explicit SimpleVector(QPair<Data*, T*> ptr, size_t len = 0)
+ : d(ptr, len)
{
}
- bool empty() const { return d->size == 0; }
+ bool empty() const { return d.size == 0; }
bool isNull() const { return d.isNull(); }
bool isEmpty() const { return this->empty(); }
- bool isStatic() const { return d->ref.isStatic(); }
- bool isShared() const { return d->ref.isShared(); }
+ bool isStatic() const { return d->isStatic(); }
+ bool isShared() const { return d->isShared(); }
bool isSharedWith(const SimpleVector &other) const { return d == other.d; }
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- bool isSharable() const { return d->ref.isSharable(); }
- void setSharable(bool sharable) { d.setSharable(sharable); }
-#endif
- size_t size() const { return d->size; }
- size_t capacity() const { return d->alloc; }
+ size_t size() const { return d.size; }
+ size_t capacity() const { return d->constAllocatedCapacity(); }
iterator begin() { detach(); return d->begin(); }
iterator end() { detach(); return d->end(); }
@@ -143,10 +150,10 @@ public:
return;
if (n <= capacity()) {
- if (d->capacityReserved)
+ if (d->flags() & Data::CapacityReserved)
return;
- if (!d->ref.isShared()) {
- d->capacityReserved = 1;
+ if (!d->isShared()) {
+ d->flags() |= Data::CapacityReserved;
return;
}
}
@@ -163,7 +170,7 @@ public:
if (size() == newSize)
return;
- if (d.needsDetach() || newSize > capacity()) {
+ if (d->needsDetach() || newSize > capacity()) {
SimpleVector detached(Data::allocate(
d->detachCapacity(newSize), d->detachFlags()));
if (newSize) {
@@ -199,11 +206,11 @@ public:
return;
T *const begin = d->begin();
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
detached.d->copyAppend(first, last);
detached.d->copyAppend(begin, begin + d->size);
@@ -220,11 +227,11 @@ public:
if (first == last)
return;
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
if (d->size) {
const T *const begin = constBegin();
@@ -260,11 +267,11 @@ public:
const iterator begin = d->begin();
const iterator where = begin + position;
const iterator end = begin + d->size;
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
if (position)
detached.d->copyAppend(begin, where);
@@ -298,7 +305,7 @@ public:
const T *const begin = d->begin();
const T *const end = begin + d->size;
- if (d.needsDetach()) {
+ if (d->needsDetach()) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() - (last - first)),
d->detachFlags()));
@@ -332,7 +339,7 @@ public:
}
static SimpleVector fromRawData(const T *data, size_t size,
- QArrayData::AllocationOptions options = Data::Default)
+ QArrayData::ArrayOptions options = Data::DefaultRawFlags)
{
return SimpleVector(Data::fromRawData(data, size, options));
}
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 25e2f21d03..1366eebf97 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -37,11 +37,8 @@ struct SharedNullVerifier
{
SharedNullVerifier()
{
- Q_ASSERT(QArrayData::shared_null[0].ref.isStatic());
- Q_ASSERT(QArrayData::shared_null[0].ref.isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- Q_ASSERT(QArrayData::shared_null[0].ref.isSharable());
-#endif
+ Q_ASSERT(QArrayData::shared_null[0].isStatic());
+ Q_ASSERT(QArrayData::shared_null[0].isShared());
}
};
@@ -59,7 +56,6 @@ class tst_QArrayData : public QObject
private slots:
void referenceCounting();
void sharedNullEmpty();
- void staticData();
void simpleVector();
void simpleVectorReserve_data();
void simpleVectorReserve();
@@ -73,8 +69,6 @@ private slots:
void gccBug43247();
void arrayOps();
void arrayOps2();
- void setSharable_data();
- void setSharable();
void fromRawData_data();
void fromRawData();
void literals();
@@ -89,70 +83,42 @@ void tst_QArrayData::referenceCounting()
{
{
// Reference counting initialized to 1 (owned)
- QArrayData array = { { Q_BASIC_ATOMIC_INITIALIZER(1) }, 0, 0, 0, 0 };
+ QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(1), QArrayData::DefaultRawFlags, 0 };
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(!array.ref.isStatic());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(array.ref.isSharable());
-#endif
+ QVERIFY(!array.isStatic());
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 2);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 2);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(!array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
+ QVERIFY(!array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 0);
// Now would be a good time to free/release allocated data
}
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- // Reference counting initialized to 0 (non-sharable)
- QArrayData array = { { Q_BASIC_ATOMIC_INITIALIZER(0) }, 0, 0, 0, 0 };
-
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- QVERIFY(!array.ref.isStatic());
- QVERIFY(!array.ref.isSharable());
-
- QVERIFY(!array.ref.ref());
- // Reference counting fails, data should be copied
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- QVERIFY(!array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- // Free/release data
- }
-#endif
-
{
// Reference counting initialized to -1 (static read-only data)
- QArrayData array = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, 0 };
+ QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
- QVERIFY(array.ref.isStatic());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(array.ref.isSharable());
-#endif
+ QVERIFY(array.isStatic());
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
}
}
@@ -160,74 +126,39 @@ void tst_QArrayData::referenceCounting()
void tst_QArrayData::sharedNullEmpty()
{
QArrayData *null = const_cast<QArrayData *>(QArrayData::shared_null);
- QArrayData *empty = QArrayData::allocate(1, Q_ALIGNOF(QArrayData), 0);
-
- QVERIFY(null->ref.isStatic());
- QVERIFY(null->ref.isShared());
+ QArrayData *empty;
+ QArrayData::allocate(&empty, 1, alignof(QArrayData), 0);
- QVERIFY(empty->ref.isStatic());
- QVERIFY(empty->ref.isShared());
+ QVERIFY(null->isStatic());
+ QVERIFY(null->isShared());
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QVERIFY(empty->isStatic());
+ QVERIFY(empty->isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(null->ref.isSharable());
- QVERIFY(empty->ref.isSharable());
-#endif
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
- QVERIFY(null->ref.ref());
- QVERIFY(empty->ref.ref());
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QVERIFY(null->deref());
+ QVERIFY(empty->deref());
- QVERIFY(null->ref.deref());
- QVERIFY(empty->ref.deref());
-
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
QVERIFY(null != empty);
- QCOMPARE(null->size, 0);
- QCOMPARE(null->alloc, 0u);
- QCOMPARE(null->capacityReserved, 0u);
+ QCOMPARE(null->allocatedCapacity(), size_t(0));
- QCOMPARE(empty->size, 0);
- QCOMPARE(empty->alloc, 0u);
- QCOMPARE(empty->capacityReserved, 0u);
-}
-
-void tst_QArrayData::staticData()
-{
- QStaticArrayData<char, 10> charArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(char, 10),
- { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
- };
- QStaticArrayData<int, 10> intArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
- };
- QStaticArrayData<double, 10> doubleArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(double, 10),
- { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f }
- };
-
- QCOMPARE(charArray.header.size, 10);
- QCOMPARE(intArray.header.size, 10);
- QCOMPARE(doubleArray.header.size, 10);
-
- QCOMPARE(charArray.header.data(), reinterpret_cast<void *>(&charArray.data));
- QCOMPARE(intArray.header.data(), reinterpret_cast<void *>(&intArray.data));
- QCOMPARE(doubleArray.header.data(), reinterpret_cast<void *>(&doubleArray.data));
+ QCOMPARE(empty->allocatedCapacity(), size_t(0));
}
void tst_QArrayData::simpleVector()
{
- QArrayData data0 = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, 0 };
+ QArrayData data0 = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
QStaticArrayData<int, 7> data1 = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 7),
+ { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 },
{ 0, 1, 2, 3, 4, 5, 6 }
};
@@ -235,10 +166,10 @@ void tst_QArrayData::simpleVector()
SimpleVector<int> v1;
SimpleVector<int> v2(v1);
- SimpleVector<int> v3(static_cast<QTypedArrayData<int> *>(&data0));
- SimpleVector<int> v4(static_cast<QTypedArrayData<int> *>(&data1.header));
- SimpleVector<int> v5(static_cast<QTypedArrayData<int> *>(&data0));
- SimpleVector<int> v6(static_cast<QTypedArrayData<int> *>(&data1.header));
+ SimpleVector<int> v3(static_cast<QTypedArrayData<int> *>(&data0), 0, 0);
+ SimpleVector<int> v4(data1);
+ SimpleVector<int> v5(static_cast<QTypedArrayData<int> *>(&data0), 0, 0);
+ SimpleVector<int> v6(data1);
SimpleVector<int> v7(10, 5);
SimpleVector<int> v8(array, array + sizeof(array)/sizeof(*array));
@@ -302,17 +233,6 @@ void tst_QArrayData::simpleVector()
QVERIFY(!v7.isShared());
QVERIFY(!v8.isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(v1.isSharable());
- QVERIFY(v2.isSharable());
- QVERIFY(v3.isSharable());
- QVERIFY(v4.isSharable());
- QVERIFY(v5.isSharable());
- QVERIFY(v6.isSharable());
- QVERIFY(v7.isSharable());
- QVERIFY(v8.isSharable());
-#endif
-
QVERIFY(v1.isSharedWith(v2));
QVERIFY(v1.isSharedWith(v3));
QVERIFY(v1.isSharedWith(v4));
@@ -494,71 +414,6 @@ void tst_QArrayData::simpleVector()
for (int i = 0; i < 120; ++i)
QCOMPARE(v1[i], v8[i % 10]);
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- v7.setSharable(true);
- QVERIFY(v7.isSharable());
-
- SimpleVector<int> copy1(v7);
- QVERIFY(copy1.isSharedWith(v7));
-
- v7.setSharable(false);
- QVERIFY(!v7.isSharable());
-
- QVERIFY(!copy1.isSharedWith(v7));
- QCOMPARE(v7.size(), copy1.size());
- for (size_t i = 0; i < copy1.size(); ++i)
- QCOMPARE(v7[i], copy1[i]);
-
- SimpleVector<int> clone(v7);
- QVERIFY(!clone.isSharedWith(v7));
- QCOMPARE(clone.size(), copy1.size());
- for (size_t i = 0; i < copy1.size(); ++i)
- QCOMPARE(clone[i], copy1[i]);
-
- v7.setSharable(true);
- QVERIFY(v7.isSharable());
-
- SimpleVector<int> copy2(v7);
- QVERIFY(copy2.isSharedWith(v7));
- }
-
- {
- SimpleVector<int> null;
- SimpleVector<int> empty(0, 5);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- null.setSharable(true);
- empty.setSharable(true);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
-
- null.setSharable(false);
- empty.setSharable(false);
-
- QVERIFY(!null.isSharable());
- QVERIFY(!empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
-
- null.setSharable(true);
- empty.setSharable(true);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
- }
-#endif
}
Q_DECLARE_METATYPE(SimpleVector<int>)
@@ -574,11 +429,13 @@ void tst_QArrayData::simpleVectorReserve_data()
QTest::newRow("non-empty") << SimpleVector<int>(5, 42) << size_t(5) << size_t(5);
static const QStaticArrayData<int, 15> array = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 15),
+ { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 },
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } };
- QArrayDataPointerRef<int> p = {
+ const QArrayDataPointerRef<int> p = {
static_cast<QTypedArrayData<int> *>(
- const_cast<QArrayData *>(&array.header)) };
+ const_cast<QArrayData *>(&array.header)),
+ const_cast<int *>(array.data),
+ sizeof(array.data) / sizeof(array.data[0]) };
QTest::newRow("static") << SimpleVector<int>(p) << size_t(0) << size_t(15);
QTest::newRow("raw-data") << SimpleVector<int>::fromRawData(array.data, 15) << size_t(0) << size_t(15);
@@ -641,15 +498,14 @@ struct Deallocator
};
Q_DECLARE_METATYPE(const QArrayData *)
-Q_DECLARE_METATYPE(QArrayData::AllocationOptions)
+Q_DECLARE_METATYPE(QArrayData::ArrayOptions)
void tst_QArrayData::allocate_data()
{
QTest::addColumn<size_t>("objectSize");
QTest::addColumn<size_t>("alignment");
- QTest::addColumn<QArrayData::AllocationOptions>("allocateOptions");
+ QTest::addColumn<QArrayData::ArrayOptions>("allocateOptions");
QTest::addColumn<bool>("isCapacityReserved");
- QTest::addColumn<bool>("isSharable"); // ### Qt6: remove
QTest::addColumn<const QArrayData *>("commonEmpty");
struct {
@@ -657,35 +513,24 @@ void tst_QArrayData::allocate_data()
size_t objectSize;
size_t alignment;
} types[] = {
- { "char", sizeof(char), Q_ALIGNOF(char) },
- { "short", sizeof(short), Q_ALIGNOF(short) },
- { "void *", sizeof(void *), Q_ALIGNOF(void *) }
+ { "char", sizeof(char), alignof(char) },
+ { "short", sizeof(short), alignof(short) },
+ { "void *", sizeof(void *), alignof(void *) }
};
- QArrayData *shared_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0);
+ QArrayData *shared_empty;
+ QArrayData::allocate(&shared_empty, 1, alignof(QArrayData), 0);
QVERIFY(shared_empty);
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QArrayData *unsharable_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0, QArrayData::Unsharable);
- QVERIFY(unsharable_empty);
-#endif
-
struct {
char const *description;
- QArrayData::AllocationOptions allocateOptions;
+ QArrayData::ArrayOptions allocateOptions;
bool isCapacityReserved;
- bool isSharable;
const QArrayData *commonEmpty;
} options[] = {
- { "Default", QArrayData::Default, false, true, shared_empty },
- { "Reserved", QArrayData::CapacityReserved, true, true, shared_empty },
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- { "Reserved | Unsharable",
- QArrayData::CapacityReserved | QArrayData::Unsharable, true, false,
- unsharable_empty },
- { "Unsharable", QArrayData::Unsharable, false, false, unsharable_empty },
-#endif
- { "Grow", QArrayData::Grow, false, true, shared_empty }
+ { "Default", QArrayData::DefaultAllocationFlags, false, shared_empty },
+ { "Reserved", QArrayData::CapacityReserved, true, shared_empty },
+ { "Grow", QArrayData::GrowsForward, false, shared_empty }
};
for (size_t i = 0; i < sizeof(types)/sizeof(types[0]); ++i)
@@ -696,47 +541,45 @@ void tst_QArrayData::allocate_data()
+ QLatin1String(options[j].description)))
<< types[i].objectSize << types[i].alignment
<< options[j].allocateOptions << options[j].isCapacityReserved
- << options[j].isSharable << options[j].commonEmpty;
+ << options[j].commonEmpty;
}
void tst_QArrayData::allocate()
{
QFETCH(size_t, objectSize);
QFETCH(size_t, alignment);
- QFETCH(QArrayData::AllocationOptions, allocateOptions);
+ QFETCH(QArrayData::ArrayOptions, allocateOptions);
QFETCH(bool, isCapacityReserved);
QFETCH(const QArrayData *, commonEmpty);
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
// Shared Empty
- QCOMPARE(QArrayData::allocate(objectSize, minAlignment, 0,
- QArrayData::AllocationOptions(allocateOptions)), commonEmpty);
+ QArrayData *empty;
+ QCOMPARE((QArrayData::allocate(&empty, objectSize, minAlignment, 0,
+ QArrayData::ArrayOptions(allocateOptions)), empty), commonEmpty);
Deallocator keeper(objectSize, minAlignment);
keeper.headers.reserve(1024);
for (int capacity = 1; capacity <= 1024; capacity <<= 1) {
- QArrayData *data = QArrayData::allocate(objectSize, minAlignment,
- capacity, QArrayData::AllocationOptions(allocateOptions));
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, objectSize, minAlignment,
+ capacity, QArrayData::ArrayOptions(allocateOptions));
+
keeper.headers.append(data);
- QCOMPARE(data->size, 0);
- if (allocateOptions & QArrayData::Grow)
- QVERIFY(data->alloc > uint(capacity));
+ if (allocateOptions & QArrayData::GrowsForward)
+ QVERIFY(data->allocatedCapacity() > uint(capacity));
else
- QCOMPARE(data->alloc, uint(capacity));
- QCOMPARE(data->capacityReserved, uint(isCapacityReserved));
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(bool, isSharable);
- QCOMPARE(data->ref.isSharable(), isSharable);
-#endif
+ QCOMPARE(data->allocatedCapacity(), size_t(capacity));
+ QCOMPARE(bool(data->flags & QArrayData::CapacityReserved), isCapacityReserved);
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(data->data(), 'A', objectSize * capacity);
+ ::memset(dataPointer, 'A', objectSize * capacity);
}
}
@@ -744,47 +587,40 @@ void tst_QArrayData::reallocate()
{
QFETCH(size_t, objectSize);
QFETCH(size_t, alignment);
- QFETCH(QArrayData::AllocationOptions, allocateOptions);
+ QFETCH(QArrayData::ArrayOptions, allocateOptions);
QFETCH(bool, isCapacityReserved);
- // Maximum alignment that can be requested is that of QArrayData,
- // otherwise, we can't use reallocate().
- Q_ASSERT(alignment <= Q_ALIGNOF(QArrayData));
-
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
int capacity = 10;
Deallocator keeper(objectSize, minAlignment);
- QArrayData *data = QArrayData::allocate(objectSize, minAlignment, capacity,
- QArrayData::AllocationOptions(allocateOptions) & ~QArrayData::Grow);
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, objectSize, minAlignment, capacity,
+ QArrayData::ArrayOptions(allocateOptions) & ~QArrayData::GrowsForward);
keeper.headers.append(data);
- memset(data->data(), 'A', objectSize * capacity);
- data->size = capacity;
+ memset(dataPointer, 'A', objectSize * capacity);
// now try to reallocate
int newCapacity = 40;
- data = QArrayData::reallocateUnaligned(data, objectSize, newCapacity,
- QArrayData::AllocationOptions(allocateOptions));
+ auto pair = QArrayData::reallocateUnaligned(data, dataPointer, objectSize, newCapacity,
+ QArrayData::ArrayOptions(allocateOptions));
+ data = pair.first;
+ dataPointer = pair.second;
QVERIFY(data);
keeper.headers.clear();
keeper.headers.append(data);
- QCOMPARE(data->size, capacity);
- if (allocateOptions & QArrayData::Grow)
- QVERIFY(data->alloc > uint(newCapacity));
+ if (allocateOptions & QArrayData::GrowsForward)
+ QVERIFY(data->allocatedCapacity() > size_t(newCapacity));
else
- QCOMPARE(data->alloc, uint(newCapacity));
- QCOMPARE(data->capacityReserved, uint(isCapacityReserved));
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(bool, isSharable);
- QCOMPARE(data->ref.isSharable(), isSharable);
-#endif
+ QCOMPARE(data->allocatedCapacity(), size_t(newCapacity));
+ QCOMPARE(!(data->flags & QArrayData::CapacityReserved), !isCapacityReserved);
for (int i = 0; i < capacity; ++i)
- QCOMPARE(static_cast<char *>(data->data())[i], 'A');
+ QCOMPARE(static_cast<char *>(dataPointer)[i], 'A');
}
class Unaligned
@@ -808,95 +644,52 @@ void tst_QArrayData::alignment()
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
Deallocator keeper(sizeof(Unaligned), minAlignment);
keeper.headers.reserve(100);
for (int i = 0; i < 100; ++i) {
- QArrayData *data = QArrayData::allocate(sizeof(Unaligned),
- minAlignment, 8, QArrayData::Default);
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, sizeof(Unaligned),
+ minAlignment, 8, QArrayData::DefaultAllocationFlags);
keeper.headers.append(data);
QVERIFY(data);
- QCOMPARE(data->size, 0);
- QVERIFY(data->alloc >= uint(8));
+ QVERIFY(data->allocatedCapacity() >= uint(8));
// These conditions should hold as long as header and array are
// allocated together
- QVERIFY(data->offset >= qptrdiff(sizeof(QArrayData)));
- QVERIFY(data->offset <= qptrdiff(sizeof(QArrayData)
- + minAlignment - Q_ALIGNOF(QArrayData)));
+ qptrdiff offset = reinterpret_cast<char *>(dataPointer) -
+ reinterpret_cast<char *>(data);
+ QVERIFY(offset >= qptrdiff(sizeof(QArrayData)));
+ QVERIFY(offset <= qptrdiff(sizeof(QArrayData)
+ + minAlignment - alignof(QArrayData)));
// Data is aligned
- QCOMPARE(quintptr(quintptr(data->data()) % alignment), quintptr(0u));
+ QCOMPARE(quintptr(quintptr(dataPointer) % alignment), quintptr(0u));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(data->data(), 'A', sizeof(Unaligned) * 8);
+ ::memset(dataPointer, 'A', sizeof(Unaligned) * 8);
}
}
void tst_QArrayData::typedData()
{
- QStaticArrayData<int, 10> data = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
- };
- QCOMPARE(data.header.size, 10);
-
- {
- QTypedArrayData<int> *array =
- static_cast<QTypedArrayData<int> *>(&data.header);
- QCOMPARE(array->data(), data.data);
-
- int j = 0;
- for (QTypedArrayData<int>::iterator iter = array->begin();
- iter != array->end(); ++iter, ++j)
- QCOMPARE((const int *)iter, data.data + j);
- QCOMPARE(j, 10);
- }
-
- {
- const QTypedArrayData<int> *array =
- static_cast<const QTypedArrayData<int> *>(&data.header);
-
- QCOMPARE(array->data(), data.data);
-
- int j = 0;
- for (QTypedArrayData<int>::const_iterator iter = array->begin();
- iter != array->end(); ++iter, ++j)
- QCOMPARE((const int *)iter, data.data + j);
- QCOMPARE(j, 10);
- }
-
- {
- QTypedArrayData<int> *null = QTypedArrayData<int>::sharedNull();
- QTypedArrayData<int> *empty = QTypedArrayData<int>::allocate(0);
-
- QVERIFY(null != empty);
-
- QCOMPARE(null->size, 0);
- QCOMPARE(empty->size, 0);
-
- QCOMPARE(null->begin(), null->end());
- QCOMPARE(empty->begin(), empty->end());
- }
-
-
{
Deallocator keeper(sizeof(char),
- Q_ALIGNOF(QTypedArrayData<char>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<char>::allocate(10);
+ alignof(QTypedArrayData<char>::AlignmentDummy));
+ QPair<QTypedArrayData<char> *, char *> pair = QTypedArrayData<char>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(char));
+ ::memset(pair.second, 0, 10 * sizeof(char));
keeper.headers.clear();
QTypedArrayData<short>::deallocate(array);
@@ -906,17 +699,17 @@ void tst_QArrayData::typedData()
{
Deallocator keeper(sizeof(short),
- Q_ALIGNOF(QTypedArrayData<short>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<short>::allocate(10);
+ alignof(QTypedArrayData<short>::AlignmentDummy));
+ QPair<QTypedArrayData<short> *, short *> pair = QTypedArrayData<short>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(short));
+ ::memset(pair.second, 0, 10 * sizeof(short));
keeper.headers.clear();
QTypedArrayData<short>::deallocate(array);
@@ -926,17 +719,17 @@ void tst_QArrayData::typedData()
{
Deallocator keeper(sizeof(double),
- Q_ALIGNOF(QTypedArrayData<double>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<double>::allocate(10);
+ alignof(QTypedArrayData<double>::AlignmentDummy));
+ QPair<QTypedArrayData<double> *, double *> pair = QTypedArrayData<double>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(double));
+ ::memset(pair.second, 0, 10 * sizeof(double));
keeper.headers.clear();
QTypedArrayData<double>::deallocate(array);
@@ -1354,136 +1147,6 @@ static inline bool arrayIsFilledWith(const QArrayDataPointer<int> &array,
return true;
}
-void tst_QArrayData::setSharable_data()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QTest::addColumn<QArrayDataPointer<int> >("array");
- QTest::addColumn<size_t>("size");
- QTest::addColumn<size_t>("capacity");
- QTest::addColumn<bool>("isCapacityReserved");
- QTest::addColumn<int>("fillValue");
-
- QArrayDataPointer<int> null;
- QArrayDataPointer<int> empty; empty.clear();
-
- static QStaticArrayData<int, 10> staticArrayData = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }
- };
-
- QArrayDataPointer<int> emptyReserved(QTypedArrayData<int>::allocate(5,
- QArrayData::CapacityReserved));
- QArrayDataPointer<int> nonEmpty(QTypedArrayData<int>::allocate(5,
- QArrayData::Default));
- QArrayDataPointer<int> nonEmptyExtraCapacity(
- QTypedArrayData<int>::allocate(10, QArrayData::Default));
- QArrayDataPointer<int> nonEmptyReserved(QTypedArrayData<int>::allocate(15,
- QArrayData::CapacityReserved));
- QArrayDataPointer<int> staticArray(
- static_cast<QTypedArrayData<int> *>(&staticArrayData.header));
- QArrayDataPointer<int> rawData(
- QTypedArrayData<int>::fromRawData(staticArrayData.data, 10));
-
- nonEmpty->copyAppend(5, 1);
- nonEmptyExtraCapacity->copyAppend(5, 1);
- nonEmptyReserved->copyAppend(7, 2);
-
- QTest::newRow("shared-null") << null << size_t(0) << size_t(0) << false << 0;
- QTest::newRow("shared-empty") << empty << size_t(0) << size_t(0) << false << 0;
- // unsharable-empty implicitly tested in shared-empty
- QTest::newRow("empty-reserved") << emptyReserved << size_t(0) << size_t(5) << true << 0;
- QTest::newRow("non-empty") << nonEmpty << size_t(5) << size_t(5) << false << 1;
- QTest::newRow("non-empty-extra-capacity") << nonEmptyExtraCapacity << size_t(5) << size_t(10) << false << 1;
- QTest::newRow("non-empty-reserved") << nonEmptyReserved << size_t(7) << size_t(15) << true << 2;
- QTest::newRow("static-array") << staticArray << size_t(10) << size_t(0) << false << 3;
- QTest::newRow("raw-data") << rawData << size_t(10) << size_t(0) << false << 3;
-#endif
-}
-
-void tst_QArrayData::setSharable()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(QArrayDataPointer<int>, array);
- QFETCH(size_t, size);
- QFETCH(size_t, capacity);
- QFETCH(bool, isCapacityReserved);
- QFETCH(int, fillValue);
-
- QVERIFY(array->ref.isShared()); // QTest has a copy
- QVERIFY(array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- // shared-null becomes shared-empty, may otherwise detach
- array.setSharable(true);
-
- QVERIFY(array->ref.isSharable());
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(array->ref.isShared());
- QVERIFY(array->ref.isSharable());
- QCOMPARE(copy.data(), array.data());
- }
-
- // Unshare, must detach
- array.setSharable(false);
-
- // Immutability (alloc == 0) is lost on detach, as is additional capacity
- // if capacityReserved flag is not set.
- if ((capacity == 0 && size != 0)
- || (!isCapacityReserved && capacity > size))
- capacity = size;
-
- QVERIFY(!array->ref.isShared());
- QVERIFY(!array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(!array->ref.isShared());
- QVERIFY(!array->ref.isSharable());
-
- // Null/empty is always shared
- QCOMPARE(copy->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(copy->ref.isSharable());
-
- QCOMPARE(size_t(copy->size), size);
- QCOMPARE(size_t(copy->alloc), capacity);
- QCOMPARE(bool(copy->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(copy, fillValue, size));
- }
-
- // Make sharable, again
- array.setSharable(true);
-
- QCOMPARE(array->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(array->ref.isShared());
- QCOMPARE(copy.data(), array.data());
- }
-
- QCOMPARE(array->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(array->ref.isSharable());
-#endif
-}
-
struct ResetOnDtor
{
ResetOnDtor()
@@ -1517,7 +1180,7 @@ void fromRawData_impl()
{
// Default: Immutable, sharable
SimpleVector<T> raw = SimpleVector<T>::fromRawData(array,
- sizeof(array)/sizeof(array[0]), QArrayData::Default);
+ sizeof(array)/sizeof(array[0]), QArrayData::DefaultRawFlags);
QCOMPARE(raw.size(), size_t(11));
QCOMPARE((const T *)raw.constBegin(), array);
@@ -1531,37 +1194,6 @@ void fromRawData_impl()
QCOMPARE(raw.back(), T(11));
QVERIFY((const T *)raw.constBegin() != array);
}
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- // Immutable, unsharable
- SimpleVector<T> raw = SimpleVector<T>::fromRawData(array,
- sizeof(array)/sizeof(array[0]), QArrayData::Unsharable);
-
- QCOMPARE(raw.size(), size_t(11));
- QCOMPARE((const T *)raw.constBegin(), array);
- QCOMPARE((const T *)raw.constEnd(), (const T *)(array + sizeof(array)/sizeof(array[0])));
-
- SimpleVector<T> copy(raw);
- QVERIFY(!copy.isSharedWith(raw));
- QVERIFY(!raw.isShared());
-
- QCOMPARE(copy.size(), size_t(11));
-
- for (size_t i = 0; i < 11; ++i) {
- QCOMPARE(const_(copy)[i], const_(raw)[i]);
- QCOMPARE(const_(copy)[i], T(i + 1));
- }
-
- QCOMPARE(raw.size(), size_t(11));
- QCOMPARE((const T *)raw.constBegin(), array);
- QCOMPARE((const T *)raw.constEnd(), (const T *)(array + sizeof(array)/sizeof(array[0])));
-
- // Detach
- QCOMPARE(raw.back(), T(11));
- QVERIFY((const T *)raw.constBegin() != array);
- }
-#endif
}
void tst_QArrayData::fromRawData_data()
@@ -1593,17 +1225,17 @@ void tst_QArrayData::literals()
{
{
QArrayDataPointer<char> d = Q_ARRAY_LITERAL(char, "ABCDEFGHIJ");
- QCOMPARE(d->size, 10 + 1);
+ QCOMPARE(d.size, 10u + 1u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], char('A' + i));
+ QCOMPARE(d.data()[i], char('A' + i));
}
{
// wchar_t is not necessarily 2-bytes
QArrayDataPointer<wchar_t> d = Q_ARRAY_LITERAL(wchar_t, L"ABCDEFGHIJ");
- QCOMPARE(d->size, 10 + 1);
+ QCOMPARE(d.size, 10u + 1u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], wchar_t('A' + i));
+ QCOMPARE(d.data()[i], wchar_t('A' + i));
}
{
@@ -1615,10 +1247,6 @@ void tst_QArrayData::literals()
// v.capacity() is unspecified, for now
QVERIFY(v.isStatic());
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(v.isSharable());
-#endif
QCOMPARE((void*)(const char*)(v.constBegin() + v.size()), (void*)(const char*)v.constEnd());
for (int i = 0; i < 10; ++i)
@@ -1645,26 +1273,26 @@ void tst_QArrayData::variadicLiterals()
{
QArrayDataPointer<int> d =
Q_ARRAY_LITERAL(int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], i);
+ QCOMPARE(d.data()[i], i);
}
{
QArrayDataPointer<char> d = Q_ARRAY_LITERAL(char,
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], char('A' + i));
+ QCOMPARE(d.data()[i], char('A' + i));
}
{
QArrayDataPointer<const char *> d = Q_ARRAY_LITERAL(const char *,
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J");
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i) {
- QCOMPARE(d->data()[i][0], char('A' + i));
- QCOMPARE(d->data()[i][1], '\0');
+ QCOMPARE(d.data()[i][0], char('A' + i));
+ QCOMPARE(d.data()[i][1], '\0');
}
}
@@ -1677,10 +1305,6 @@ void tst_QArrayData::variadicLiterals()
// v.capacity() is unspecified, for now
QVERIFY(v.isStatic());
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(v.isSharable());
-#endif
QCOMPARE((const int *)(v.constBegin() + v.size()), (const int *)v.constEnd());
for (int i = 0; i < 7; ++i)
diff --git a/tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro b/tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro
deleted file mode 100644
index b01fbd84d1..0000000000
--- a/tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qarraydata/qarraydata.pro)
-TARGET = tst_qarraydata_strictiterators
-DEFINES += QT_STRICT_ITERATORS=1 tst_QArrayData=tst_QArrayData_StrictIterators
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index b98ac38288..91cd3eb0bd 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -1373,13 +1373,6 @@ void tst_QHash::noNeedlessRehashes()
void tst_QHash::const_shared_null()
{
QHash<int, QString> hash2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QHash<int, QString> hash1;
- hash1.setSharable(false);
- QVERIFY(hash1.isDetached());
-
- hash2.setSharable(true);
-#endif
QVERIFY(!hash2.isDetached());
}
diff --git a/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro b/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro
deleted file mode 100644
index 715e9bf0c9..0000000000
--- a/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qhash/qhash.pro)
-TARGET = tst_qhash_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QHash=tst_QHash_StrictIterators
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
index df42b5dea9..ed0abff456 100644
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
@@ -225,8 +225,6 @@ private slots:
void constSharedNullInt() const;
void constSharedNullMovable() const;
void constSharedNullComplex() const;
-
- void setSharableInt() const;
private:
template<typename T> void length() const;
template<typename T> void first() const;
@@ -1048,13 +1046,6 @@ template<typename T>
void tst_QLinkedList::constSharedNull() const
{
QLinkedList<T> list2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QLinkedList<T> list1;
- list1.setSharable(false);
- QVERIFY(list1.isDetached());
-
- list2.setSharable(true);
-#endif
QVERIFY(!list2.isDetached());
}
@@ -1077,57 +1068,5 @@ void tst_QLinkedList::constSharedNullComplex() const
QCOMPARE(liveCount, Complex::getLiveCount());
}
-
-void tst_QLinkedList::setSharableInt() const
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QLinkedList<int> orglist;
- orglist << 0 << 1 << 2 << 3 << 4 << 5;
- int size = 6;
-
- QLinkedList<int> list;
- list = orglist;
-
- QVERIFY(!list.isDetached());
- list.setSharable(true);
-
- QCOMPARE(list.size(), size);
-
- {
- QLinkedList<int> copy(list);
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- list.setSharable(false);
- QVERIFY(list.isDetached() || list.isSharedWith(QLinkedList<int>()));
-
- {
- QLinkedList<int> copy(list);
-
- QVERIFY(copy.isDetached() || copy.isSharedWith(QLinkedList<int>()));
- QCOMPARE(copy.size(), size);
- QCOMPARE(copy, list);
- }
-
- list.setSharable(true);
-
- {
- QLinkedList<int> copy(list);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- QLinkedList<int>::const_iterator it = list.constBegin();
- for (int i = 0; i < list.size(); ++i) {
- QCOMPARE(int(*it), i);
- ++it;
- }
-
- QCOMPARE(list.size(), size);
-#endif
-}
-
QTEST_APPLESS_MAIN(tst_QLinkedList)
#include "tst_qlinkedlist.moc"
diff --git a/tests/auto/corelib/tools/qlist/.gitignore b/tests/auto/corelib/tools/qlist/.gitignore
deleted file mode 100644
index df208b6e78..0000000000
--- a/tests/auto/corelib/tools/qlist/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qlist
diff --git a/tests/auto/corelib/tools/qlist/qlist.pro b/tests/auto/corelib/tools/qlist/qlist.pro
deleted file mode 100644
index 118c607880..0000000000
--- a/tests/auto/corelib/tools/qlist/qlist.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qlist
-QT = core testlib
-qtConfig(c++14): CONFIG += c++14
-qtConfig(c++1z): CONFIG += c++1z
-SOURCES = $$PWD/tst_qlist.cpp
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
deleted file mode 100644
index cc9a3a16d1..0000000000
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ /dev/null
@@ -1,2115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QList>
-
-template <typename T, class MemoryLayout>
-class is_qlist_array_memory_layout {
- struct No { char c; };
- struct Yes { No n[2]; };
- Q_STATIC_ASSERT(sizeof(No) != sizeof(Yes));
- static No check(...);
- static Yes check(MemoryLayout);
-public:
- enum { value = sizeof(check(typename QList<T>::MemoryLayout())) == sizeof(Yes) };
-};
-
-struct Movable {
- Movable(char input = 'j')
- : i(input)
- , state(Constructed)
- {
- ++liveCount;
- }
- Movable(const Movable &other)
- : i(other.i)
- , state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Movable()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- bool operator<(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i < other.i;
- }
-
- Movable &operator=(const Movable &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- uchar state;
-
- static void check(const uchar state1, const uchar state2)
- {
- QCOMPARE(state1, state2);
- }
-};
-
-Q_STATIC_ASSERT(sizeof(Movable) < sizeof(void*));
-
-int Movable::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Movable);
-
-int qHash(const Movable& movable)
-{
- return qHash(movable.i);
-}
-
-struct Optimal
-{
- Optimal(char input = 'j')
- : i(input),
- state(Constructed)
- {
- ++liveCount;
- }
- Optimal(const Optimal &other)
- : i(other.i),
- state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Optimal()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Optimal &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- bool operator<(const Optimal &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i < other.i;
- }
-
- Optimal &operator=(const Optimal &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- uchar state;
- char padding[sizeof(void*) - 2];
-
- static void check(const uchar state1, const uchar state2)
- {
- QCOMPARE(state1, state2);
- }
-};
-
-Q_STATIC_ASSERT(sizeof(Optimal) == sizeof(void*));
-
-int Optimal::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Optimal, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Optimal);
-
-int qHash(const Optimal& key)
-{
- return qHash(key.i);
-}
-
-struct Complex
-{
- Complex(int val = 0)
- : value(val)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex(Complex const &other)
- : value(other.value)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex &operator=(Complex const &other)
- {
- check(); other.check();
-
- value = other.value;
- return *this;
- }
-
- ~Complex()
- {
- --liveCount;
- check();
- }
-
- operator int() const { return value; }
-
- bool operator==(Complex const &other) const
- {
- check(); other.check();
- return value == other.value;
- }
-
- bool operator<(Complex const &other) const
- {
- check(); other.check();
- return value < other.value;
- }
-
- void check() const
- {
- QVERIFY(this == checkSum);
- }
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- int value;
- void *checkSum;
-};
-
-int Complex::liveCount = 0;
-
-Q_DECLARE_METATYPE(Complex);
-
-// Tests depend on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Optimal>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Optimal>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isComplex);
-// iow:
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<int, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<int, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Optimal, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Optimal, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Movable, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Movable, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Complex, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Complex, QListData::IndirectLayout> ::value));
-
-class tst_QList : public QObject
-{
- Q_OBJECT
-
-private slots:
- void lengthOptimal() const;
- void lengthMovable() const;
- void lengthComplex() const;
- void lengthSignature() const;
- void appendOptimal() const;
- void appendMovable() const;
- void appendComplex() const;
- void prepend() const;
- void midOptimal() const;
- void midMovable() const;
- void midComplex() const;
- void atOptimal() const;
- void atMovable() const;
- void atComplex() const;
- void firstOptimal() const;
- void firstMovable() const;
- void firstComplex() const;
- void lastOptimal() const;
- void lastMovable() const;
- void lastComplex() const;
- void constFirst() const;
- void constLast() const;
- void cpp17ctad() const;
- void beginOptimal() const;
- void beginMovable() const;
- void beginComplex() const;
- void endOptimal() const;
- void endMovable() const;
- void endComplex() const;
- void containsOptimal() const;
- void containsMovable() const;
- void containsComplex() const;
- void countOptimal() const;
- void countMovable() const;
- void countComplex() const;
- void emptyOptimal() const;
- void emptyMovable() const;
- void emptyComplex() const;
- void endsWithOptimal() const;
- void endsWithMovable() const;
- void endsWithComplex() const;
- void lastIndexOfOptimal() const;
- void lastIndexOfMovable() const;
- void lastIndexOfComplex() const;
- void moveOptimal() const;
- void moveMovable() const;
- void moveComplex() const;
- void removeAllOptimal() const;
- void removeAllMovable() const;
- void removeAllComplex() const;
- void removeAtOptimal() const;
- void removeAtMovable() const;
- void removeAtComplex() const;
- void removeOneOptimal() const;
- void removeOneMovable() const;
- void removeOneComplex() const;
- void replaceOptimal() const;
- void replaceMovable() const;
- void replaceComplex() const;
- void reverseIteratorsOptimal() const;
- void reverseIteratorsMovable() const;
- void reverseIteratorsComplex() const;
- void startsWithOptimal() const;
- void startsWithMovable() const;
- void startsWithComplex() const;
- void swapOptimal() const;
- void swapMovable() const;
- void swapComplex() const;
- void takeAtOptimal() const;
- void takeAtMovable() const;
- void takeAtComplex() const;
- void takeFirstOptimal() const;
- void takeFirstMovable() const;
- void takeFirstComplex() const;
- void takeLastOptimal() const;
- void takeLastMovable() const;
- void takeLastComplex() const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- void toSetOptimal() const;
- void toSetMovable() const;
- void toSetComplex() const;
- void toStdListOptimal() const;
- void toStdListMovable() const;
- void toStdListComplex() const;
-#endif
- void toVectorOptimal() const;
- void toVectorMovable() const;
- void toVectorComplex() const;
- void valueOptimal() const;
- void valueMovable() const;
- void valueComplex() const;
-
- void testOperatorsOptimal() const;
- void testOperatorsMovable() const;
- void testOperatorsComplex() const;
- void testSTLIteratorsOptimal() const;
- void testSTLIteratorsMovable() const;
- void testSTLIteratorsComplex() const;
-
- void initializeList() const;
-
- void constSharedNullOptimal() const;
- void constSharedNullMovable() const;
- void constSharedNullComplex() const;
- void setSharableInt_data() const;
- void setSharableInt() const;
- void setSharableComplex_data() const;
- void setSharableComplex() const;
- void eraseValidIteratorsOnSharedList() const;
- void insertWithValidIteratorsOnSharedList() const;
-
- void qhashOptimal() const { qhash<Optimal>(); }
- void qhashMovable() const { qhash<Movable>(); }
- void qhashComplex() const { qhash<Complex>(); }
- void reserve() const;
-private:
- template<typename T> void length() const;
- template<typename T> void append() const;
- template<typename T> void mid() const;
- template<typename T> void at() const;
- template<typename T> void first() const;
- template<typename T> void last() const;
- template<typename T> void begin() const;
- template<typename T> void end() const;
- template<typename T> void contains() const;
- template<typename T> void count() const;
- template<typename T> void empty() const;
- template<typename T> void endsWith() const;
- template<typename T> void lastIndexOf() const;
- template<typename T> void move() const;
- template<typename T> void qhash() const;
- template<typename T> void removeAll() const;
- template<typename T> void removeAt() const;
- template<typename T> void removeOne() const;
- template<typename T> void replace() const;
- template<typename T> void reverseIterators() const;
- template<typename T> void startsWith() const;
- template<typename T> void swap() const;
- template<typename T> void takeAt() const;
- template<typename T> void takeFirst() const;
- template<typename T> void takeLast() const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- template<typename T> void toSet() const;
- template<typename T> void toStdList() const;
-#endif
- template<typename T> void toVector() const;
- template<typename T> void value() const;
-
- template<typename T> void testOperators() const;
- template<typename T> void testSTLIterators() const;
-
- template<typename T> void constSharedNull() const;
-
- int dummyForGuard;
-};
-
-template<typename T> struct SimpleValue
-{
- static T at(int index)
- {
- return values[index % maxSize];
- }
- static const uint maxSize = 7;
- static const T values[maxSize];
-};
-
-template<>
-const Optimal SimpleValue<Optimal>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Movable SimpleValue<Movable>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Complex SimpleValue<Complex>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-
-// Make some macros for the tests to use in order to be slightly more readable...
-#define T_FOO SimpleValue<T>::at(0)
-#define T_BAR SimpleValue<T>::at(1)
-#define T_BAZ SimpleValue<T>::at(2)
-#define T_CAT SimpleValue<T>::at(3)
-#define T_DOG SimpleValue<T>::at(4)
-#define T_BLAH SimpleValue<T>::at(5)
-#define T_WEEE SimpleValue<T>::at(6)
-
-template<typename T>
-void tst_QList::length() const
-{
- /* Empty list. */
- {
- const QList<T> list;
- QCOMPARE(list.length(), 0);
- }
-
- /* One entry. */
- {
- QList<T> list;
- list.append(T_FOO);
- QCOMPARE(list.length(), 1);
- }
-
- /* Two entries. */
- {
- QList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- QCOMPARE(list.length(), 2);
- }
-
- /* Three entries. */
- {
- QList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- list.append(T_BAZ);
- QCOMPARE(list.length(), 3);
- }
-}
-
-void tst_QList::lengthOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- length<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lengthMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- length<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lengthComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- length<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::lengthSignature() const
-{
- /* Constness. */
- {
- const QList<int> list;
- /* The function should be const. */
- list.length();
- }
-}
-
-template<typename T>
-void tst_QList::append() const
-{
- /* test append(const QList<T> &) function */
- T one(T_FOO);
- T two(T_BAR);
- T three(T_BAZ);
- T four(T_CAT);
- QList<T> list1;
- QList<T> list2;
- QList<T> listTotal;
- list1.append(one);
- list1.append(two);
- list2.append(three);
- list2.append(four);
- list1.append(list2);
- listTotal.append(one);
- listTotal.append(two);
- listTotal.append(three);
- listTotal.append(four);
- QCOMPARE(list1, listTotal);
-}
-
-void tst_QList::appendOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- append<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::appendMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- append<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::appendComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- append<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::prepend() const
-{
- QList<int *> list;
- int *t1 = new int(0);
- list.prepend(t1);
- QVERIFY(list.size() == 1);
- QVERIFY(list.at(0) == t1);
- int *t2 = new int(0);
- list.prepend(t2);
- QVERIFY(list.size() == 2);
- QVERIFY(list.at(0) == t2);
- QVERIFY(list.at(1) == t1);
- int *t3 = new int(0);
- list.prepend(t3);
- QVERIFY(list.size() == 3);
- QVERIFY(list.at(0) == t3);
- QVERIFY(list.at(1) == t2);
- QVERIFY(list.at(2) == t1);
- list.removeAll(t2);
- delete t2;
- QVERIFY(list.size() == 2);
- QVERIFY(list.at(0) == t3);
- QVERIFY(list.at(1) == t1);
- int *t4 = new int(0);
- list.prepend(t4);
- QVERIFY(list.size() == 3);
- QVERIFY(list.at(0) == t4);
- QVERIFY(list.at(1) == t3);
- QVERIFY(list.at(2) == t1);
- qDeleteAll(list);
- list.clear();
-}
-
-template<typename T>
-void tst_QList::mid() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ << T_CAT << T_DOG << T_BLAH << T_WEEE;
-
- QCOMPARE(list.mid(3, 3),
- QList<T>() << T_CAT << T_DOG << T_BLAH);
-
- QList<T> list1;
- QCOMPARE(list1.mid(1, 1).length(), 0);
-}
-
-void tst_QList::midOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- mid<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::midMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- mid<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::midComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- mid<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::at() const
-{
- // test at() and make sure it functions correctly with some simple list manipulation.
- QList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- QVERIFY(list.size() == 3);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAR);
- QCOMPARE(list.at(2), T_BAZ);
-
- // append an item
- list << T_CAT;
- QVERIFY(list.size() == 4);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAR);
- QCOMPARE(list.at(2), T_BAZ);
- QCOMPARE(list.at(3), T_CAT);
-
- // remove an item
- list.removeAt(1);
- QVERIFY(list.size() == 3);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAZ);
- QCOMPARE(list.at(2), T_CAT);
-}
-
-void tst_QList::atOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- at<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::atMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- at<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::atComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- at<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::first() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.first(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.first(), T_BAR);
-}
-
-void tst_QList::firstOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- first<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::firstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- first<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::firstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- first<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::constFirst() const
-{
- // Based on tst_QVector::constFirst()
- QList<int> list;
- list << 69 << 42 << 3;
-
- // test it starts ok
- QCOMPARE(list.constFirst(), 69);
- QVERIFY(list.isDetached());
-
- QList<int> listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 69);
- QCOMPARE(listCopy.constFirst(), 69);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test removal changes
- list.removeAt(0);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constFirst(), 42);
- QCOMPARE(listCopy.constFirst(), 69);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 42);
- QCOMPARE(listCopy.constFirst(), 42);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test prepend changes
- list.prepend(23);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constFirst(), 23);
- QCOMPARE(listCopy.constFirst(), 42);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 23);
- QCOMPARE(listCopy.constFirst(), 23);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-}
-
-void tst_QList::constLast() const
-{
- // Based on tst_QVector::constLast()
- QList<int> list;
- list << 69 << 42 << 3;
-
- // test it starts ok
- QCOMPARE(list.constLast(), 3);
- QVERIFY(list.isDetached());
-
- QList<int> listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 3);
- QCOMPARE(listCopy.constLast(), 3);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test removal changes
- list.removeLast();
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constLast(), 42);
- QCOMPARE(listCopy.constLast(), 3);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 42);
- QCOMPARE(listCopy.constLast(), 42);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test prepend changes
- list.append(23);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constLast(), 23);
- QCOMPARE(listCopy.constLast(), 42);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 23);
- QCOMPARE(listCopy.constLast(), 23);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-}
-
-void tst_QList::cpp17ctad() const
-{
-#ifdef __cpp_deduction_guides
-#define QVERIFY_IS_LIST_OF(obj, Type) \
- QVERIFY2((std::is_same<decltype(obj), QList<Type>>::value), \
- QMetaType::typeName(qMetaTypeId<decltype(obj)::value_type>()))
-#define CHECK(Type, One, Two, Three) \
- do { \
- const Type v[] = {One, Two, Three}; \
- QList v1 = {One, Two, Three}; \
- QVERIFY_IS_LIST_OF(v1, Type); \
- QList v2(v1.begin(), v1.end()); \
- QVERIFY_IS_LIST_OF(v2, Type); \
- QList v3(std::begin(v), std::end(v)); \
- QVERIFY_IS_LIST_OF(v3, Type); \
- } while (false) \
- /*end*/
- CHECK(int, 1, 2, 3);
- CHECK(double, 1.0, 2.0, 3.0);
- CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three"));
-#undef QVERIFY_IS_LIST_OF
-#undef CHECK
-#else
- QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler.");
-#endif
-}
-
-template<typename T>
-void tst_QList::last() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.last(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.last(), T_FOO);
-}
-
-void tst_QList::lastOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- last<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- last<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- last<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::begin() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*list.begin(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(*list.begin(), T_BAR);
-}
-
-void tst_QList::beginOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- begin<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::beginMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- begin<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::beginComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- begin<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::end() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*--list.end(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(*--list.end(), T_FOO);
-}
-
-void tst_QList::endOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- end<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::endMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- end<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::endComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- end<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::contains() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QVERIFY(list.contains(T_FOO));
- QVERIFY(list.contains(T_BLAH) != true);
-
- // add it and make sure it matches
- list.append(T_BLAH);
- QVERIFY(list.contains(T_BLAH));
-}
-
-void tst_QList::containsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- contains<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::containsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- contains<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::containsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- contains<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::count() const
-{
- QList<T> list;
-
- // starts empty
- QVERIFY(list.count() == 0);
-
- // goes up
- list.append(T_FOO);
- QVERIFY(list.count() == 1);
-
- // and up
- list.append(T_BAR);
- QVERIFY(list.count() == 2);
-
- // and down
- list.pop_back();
- QVERIFY(list.count() == 1);
-
- // and empty. :)
- list.pop_back();
- QVERIFY(list.count() == 0);
-}
-
-void tst_QList::countOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- count<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::countMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- count<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::countComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- count<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::empty() const
-{
- QList<T> list;
-
- // make sure it starts empty
- QVERIFY(list.empty());
-
- // and doesn't stay empty
- list.append(T_FOO);
- QVERIFY(!list.empty());
-
- // and goes back to being empty
- list.pop_back();
- QVERIFY(list.empty());
-}
-
-void tst_QList::emptyOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- empty<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::emptyMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- empty<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::emptyComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- empty<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::endsWith() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test it returns correctly in both cases
- QVERIFY(list.endsWith(T_BAZ));
- QVERIFY(!list.endsWith(T_BAR));
-
- // remove an item and make sure the end item changes
- list.pop_back();
- QVERIFY(list.endsWith(T_BAR));
-}
-
-void tst_QList::endsWithOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- endsWith<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::endsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- endsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::endsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- endsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::lastIndexOf() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // one instance of the target item
- QVERIFY(list.lastIndexOf(T_BAZ) == 2);
-
- // shouldn't find this
- QVERIFY(list.lastIndexOf(T_WEEE) == -1);
-
- // multiple instances
- list.append(T_BAZ);
- list.append(T_BAZ);
- QVERIFY(list.lastIndexOf(T_BAZ) == 4);
-
- // search from the middle to find the last one
- QVERIFY(list.lastIndexOf(T_BAZ, 3) == 3);
-
- // try to find none
- QVERIFY(list.lastIndexOf(T_BAZ, 1) == -1);
-}
-
-void tst_QList::lastIndexOfOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- lastIndexOf<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lastIndexOfMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- lastIndexOf<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lastIndexOfComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- lastIndexOf<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::move() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // move an item
- list.move(0, list.count() - 1);
- QCOMPARE(list, QList<T>() << T_BAR << T_BAZ << T_FOO);
-
- // move it back
- list.move(list.count() - 1, 0);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-
- // move an item in the middle
- list.move(1, 0);
- QCOMPARE(list, QList<T>() << T_BAR << T_FOO << T_BAZ);
-}
-
-void tst_QList::moveOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- move<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::moveMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- move<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::moveComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- move<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeAll() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // remove one instance
- list.removeAll(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // many instances
- list << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ;
- list.removeAll(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-
- // try remove something that doesn't exist
- list.removeAll(T_WEEE);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-}
-
-void tst_QList::removeAllOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeAll<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeAllMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAll<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeAllComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAll<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeAt() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeAt(1);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeAt(0);
- QCOMPARE(list, QList<T>() << T_BAZ);
-
- // final
- list.removeAt(0);
- QCOMPARE(list, QList<T>());
-}
-
-void tst_QList::removeAtOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeAt<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeAtMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAt<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeAtComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAt<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeOne() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeOne(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeOne(T_FOO);
- QCOMPARE(list, QList<T>() << T_BAZ);
-
- // last
- list.removeOne(T_BAZ);
- QCOMPARE(list, QList<T>());
-
- // make sure it really only removes one :)
- list << T_FOO << T_FOO;
- list.removeOne(T_FOO);
- QCOMPARE(list, QList<T>() << T_FOO);
-
- // try remove something that doesn't exist
- list.removeOne(T_WEEE);
- QCOMPARE(list, QList<T>() << T_FOO);
-}
-
-void tst_QList::removeOneOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeOne<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeOneMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeOne<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeOneComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeOne<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::replace() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // start
- list.replace(0, T_CAT);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_BAR << T_BAZ);
-
- // middle
- list.replace(1, T_DOG);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_DOG << T_BAZ);
-
- // end
- list.replace(2, T_BLAH);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_DOG << T_BLAH);
-}
-
-void tst_QList::replaceOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- replace<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::replaceMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- replace<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::replaceComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- replace<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::reverseIterators() const
-{
- QList<T> v;
- v << T_CAT << T_DOG << T_BLAH << T_BAZ;
- QList<T> vr = v;
- std::reverse(vr.begin(), vr.end());
- const QList<T> &cvr = vr;
- QVERIFY(std::equal(v.begin(), v.end(), vr.rbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), vr.crbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), cvr.rbegin()));
- QVERIFY(std::equal(vr.rbegin(), vr.rend(), v.begin()));
- QVERIFY(std::equal(vr.crbegin(), vr.crend(), v.begin()));
- QVERIFY(std::equal(cvr.rbegin(), cvr.rend(), v.begin()));
-}
-
-void tst_QList::reverseIteratorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- reverseIterators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::reverseIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- reverseIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::reverseIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- reverseIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::startsWith() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // make sure it starts ok
- QVERIFY(list.startsWith(T_FOO));
-
- // remove an item
- list.removeFirst();
- QVERIFY(list.startsWith(T_BAR));
-}
-
-void tst_QList::startsWithOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- startsWith<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::startsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- startsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::startsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- startsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::swap() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // swap
- list.swapItemsAt(0, 2);
- QCOMPARE(list, QList<T>() << T_BAZ << T_BAR << T_FOO);
-
- // swap again
- list.swapItemsAt(1, 2);
- QCOMPARE(list, QList<T>() << T_BAZ << T_FOO << T_BAR);
-
- QList<T> list2;
- list2 << T_DOG << T_BLAH;
-
- list.swap(list2);
- QCOMPARE(list, QList<T>() << T_DOG << T_BLAH);
- QCOMPARE(list2, QList<T>() << T_BAZ << T_FOO << T_BAR);
-}
-
-void tst_QList::swapOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- swap<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::swapMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- swap<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::swapComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- swap<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeAt() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeAt(0), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeAt(1), T_BAZ);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeAt(0), T_BAR);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QList::takeAtOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeAt<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeAtMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeAt<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeAtComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeAt<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeFirst() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeFirst(), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeFirst(), T_BAR);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeFirst(), T_BAZ);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QList::takeFirstOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeFirst<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeFirstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeFirst<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeFirstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeFirst<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeLast() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeLast(), T_BAZ);
- QCOMPARE(list.takeLast(), T_BAR);
- QCOMPARE(list.takeLast(), T_FOO);
-}
-
-void tst_QList::takeLastOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeLast<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeLastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeLast<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeLastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeLast<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-template<typename T>
-void tst_QList::toSet() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // no duplicates
- QCOMPARE(list.toSet(), QSet<T>() << T_FOO << T_BAR << T_BAZ);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-
- // duplicates (is this more of a QSet test?)
- list << T_FOO << T_BAR << T_BAZ;
- QCOMPARE(list.toSet(), QSet<T>() << T_FOO << T_BAR << T_BAZ);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toSetOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toSet<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toSetMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toSet<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toSetComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toSet<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::toStdList() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // yuck.
- std::list<T> slist;
- slist.push_back(T_FOO);
- slist.push_back(T_BAR);
- slist.push_back(T_BAZ);
-
- QCOMPARE(list.toStdList(), slist);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toStdListOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toStdList<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toStdListMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toStdList<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toStdListComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toStdList<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-#endif
-
-template<typename T>
-void tst_QList::toVector() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.toVector(), QVector<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toVectorOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toVector<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toVectorMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toVector<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toVectorComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toVector<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::value() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test real values
- QCOMPARE(list.value(0), T_FOO);
- QCOMPARE(list.value(2), T_BAZ);
-
- // test empty default
- QCOMPARE(list.value(3), T());
- QCOMPARE(list.value(-1), T());
-
- // test defaults
- T defaultT(T_WEEE);
- QCOMPARE(list.value(-1, defaultT), defaultT);
- QCOMPARE(list.value(3, defaultT), defaultT);
-}
-
-void tst_QList::valueOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- value<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::valueMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- value<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::valueComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- value<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::testOperators() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QList<T> listtwo;
- listtwo << T_FOO << T_BAR << T_BAZ;
-
- // test equal
- QVERIFY(list == listtwo);
-
- // not equal
- listtwo.append(T_CAT);
- QVERIFY(list != listtwo);
-
- // +=
- list += listtwo;
- QVERIFY(list.size() == 7);
- QVERIFY(listtwo.size() == 4);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // =
- list = listtwo;
- QCOMPARE(list, listtwo);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // []
- QCOMPARE(list[0], T_FOO);
- QCOMPARE(list[list.size() - 1], T_CAT);
-
- // <, >, <=, >=
- QVERIFY(!(list < listtwo));
- QVERIFY(!(list > listtwo));
- QVERIFY( list <= listtwo);
- QVERIFY( list >= listtwo);
- listtwo.push_back(T_CAT);
- QVERIFY( list < listtwo);
- QVERIFY(!(list > listtwo));
- QVERIFY( list <= listtwo);
- QVERIFY(!(list >= listtwo));
- QVERIFY(listtwo > list);
- QVERIFY(listtwo >= list);
-}
-
-void tst_QList::testOperatorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- testOperators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::testOperatorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testOperators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::testOperatorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testOperators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::testSTLIterators() const
-{
- QList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- typename QList<T>::iterator it = list.begin();
- QCOMPARE(*it, T_FOO); it++;
- QCOMPARE(*it, T_BAR); it++;
- QCOMPARE(*it, T_BAZ); it++;
- QCOMPARE(it, list.end()); it--;
-
- // walk backwards
- QCOMPARE(*it, T_BAZ); it--;
- QCOMPARE(*it, T_BAR); it--;
- QCOMPARE(*it, T_FOO);
-
- // test erase
- it = list.erase(it);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it, T_BAR);
-
- // test multiple erase
- it = list.erase(it, it + 2);
- QVERIFY(list.size() == 0);
- QCOMPARE(it, list.end());
-
- // insert again
- it = list.insert(it, T_FOO);
- QVERIFY(list.size() == 1);
- QCOMPARE(*it, T_FOO);
-
- // insert again
- it = list.insert(it, T_BAR);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it++, T_BAR);
- QCOMPARE(*it, T_FOO);
-}
-
-void tst_QList::testSTLIteratorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- testSTLIterators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::testSTLIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testSTLIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::testSTLIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testSTLIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::initializeList() const
-{
- QList<int> v1{2,3,4};
- QCOMPARE(v1, QList<int>() << 2 << 3 << 4);
- QCOMPARE(v1, (QList<int>{2,3,4}));
-
- QList<QList<int>> v2{ v1, {1}, QList<int>(), {2,3,4} };
- QList<QList<int>> v3;
- v3 << v1 << (QList<int>() << 1) << QList<int>() << v1;
- QCOMPARE(v3, v2);
-}
-
-template<typename T>
-void tst_QList::constSharedNull() const
-{
- QList<T> list2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QList<T> list1;
- list1.setSharable(false);
- QVERIFY(list1.isDetached());
-
- list2.setSharable(true);
-#endif
- QVERIFY(!list2.isDetached());
-}
-
-void tst_QList::constSharedNullOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- constSharedNull<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::constSharedNullMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- constSharedNull<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::constSharedNullComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- constSharedNull<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template <class T>
-void generateSetSharableData()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QTest::addColumn<QList<T> >("list");
- QTest::addColumn<int>("size");
-
- QTest::newRow("null") << QList<T>() << 0;
- QTest::newRow("non-empty") << (QList<T>() << T(0) << T(1) << T(2) << T(3) << T(4)) << 5;
-#endif
-}
-
-template <class T>
-void runSetSharableTest()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(QList<T>, list);
- QFETCH(int, size);
-
- QVERIFY(!list.isDetached()); // Shared with QTest
-
- list.setSharable(true);
-
- QCOMPARE(list.size(), size);
-
- {
- QList<T> copy(list);
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- list.setSharable(false);
- QVERIFY(list.isDetached() || list.isSharedWith(QList<T>()));
-
- {
- QList<T> copy(list);
-
- QVERIFY(copy.isDetached() || copy.isSharedWith(QList<T>()));
- QCOMPARE(copy.size(), size);
- QCOMPARE(copy, list);
- }
-
- list.setSharable(true);
-
- {
- QList<T> copy(list);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- for (int i = 0; i < list.size(); ++i)
- QCOMPARE(int(list[i]), i);
-
- QCOMPARE(list.size(), size);
-#endif
-}
-
-void tst_QList::setSharableInt_data() const
-{
- generateSetSharableData<int>();
-}
-
-void tst_QList::setSharableComplex_data() const
-{
- generateSetSharableData<Complex>();
-}
-
-void tst_QList::setSharableInt() const
-{
- runSetSharableTest<int>();
-}
-
-void tst_QList::setSharableComplex() const
-{
- runSetSharableTest<Complex>();
-}
-
-void tst_QList::eraseValidIteratorsOnSharedList() const
-{
- QList<int> a, b;
- a.push_back(10);
- a.push_back(20);
- a.push_back(30);
- QList<int>::iterator i = a.begin();
- ++i;
- b = a;
- a.erase(i);
- QCOMPARE(b.size(), 3);
- QCOMPARE(a.size(), 2);
- QCOMPARE(a.at(0), 10);
- QCOMPARE(a.at(1), 30);
-
- a.push_back(40);
- a.push_back(50);
- a.push_back(60);
- QCOMPARE(a.size(), 5);
- i = a.begin();
- b = a;
- ++i;
- QList<int>::iterator j = i;
- ++j;
- ++j;
- a.erase(i, j); // remove 3 elements
- QCOMPARE(b.size(), 5);
- QCOMPARE(a.size(), 3);
- QCOMPARE(a.at(0), 10);
- QCOMPARE(a.at(1), 50);
-}
-
-void tst_QList::insertWithValidIteratorsOnSharedList() const
-{
- QList<int> a, b;
- a.push_back(10);
- a.push_back(20);
- a.push_back(30);
- QList<int>::iterator i = a.begin();
- ++i;
- b = a;
- a.insert(i, 15);
- QCOMPARE(a.size(), b.size() + 1);
- QCOMPARE(b.at(1), 20);
- QCOMPARE(a.at(1), 15);
-}
-
-template <typename T>
-void tst_QList::qhash() const
-{
- QList<T> l1, l2;
- QCOMPARE(qHash(l1), qHash(l2));
- l1 << T_BAR;
- l2 << T_BAR;
- QCOMPARE(qHash(l1), qHash(l2));
-}
-
-void tst_QList::reserve() const
-{
- // Note:
- // This test depends on QList's current behavior that ints are stored in the array itself.
- // This test would not work for QList<Complex>.
- int capacity = 100;
- QList<int> list;
- list.reserve(capacity);
- list << 0;
- int *data = &list[0];
-
- for (int i = 1; i < capacity; i++) {
- list << i;
- QCOMPARE(&list.at(0), data);
- }
-
- QList<int> copy = list;
- list.reserve(capacity / 2);
- QCOMPARE(list.size(), capacity); // we didn't shrink the size!
-
- copy = list;
- list.reserve(capacity * 2);
- QCOMPARE(list.size(), capacity);
- QVERIFY(&list.at(0) != data);
-}
-
-QTEST_APPLESS_MAIN(tst_QList)
-#include "tst_qlist.moc"
diff --git a/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro b/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro
deleted file mode 100644
index e39ad38919..0000000000
--- a/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qlist/qlist.pro)
-TARGET = tst_qlist_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QList=tst_QList_StrictIterators
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index d66fd28779..85733639b8 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -68,7 +68,6 @@ private slots:
void const_shared_null();
void equal_range();
- void setSharable();
void insert();
void checkMostLeftNode();
@@ -1065,13 +1064,6 @@ void tst_QMap::qmultimap_specific()
void tst_QMap::const_shared_null()
{
QMap<int, QString> map2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QMap<int, QString> map1;
- map1.setSharable(false);
- QVERIFY(map1.isDetached());
-
- map2.setSharable(true);
-#endif
QVERIFY(!map2.isDetached());
}
@@ -1160,61 +1152,6 @@ const T &const_(const T &t)
return t;
}
-void tst_QMap::setSharable()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QMap<int, QString> map;
-
- map.insert(1, "um");
- map.insert(2, "dois");
- map.insert(4, "quatro");
- map.insert(5, "cinco");
-
- map.setSharable(true);
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(!map.isDetached());
- QVERIFY(copy.isSharedWith(map));
- sanityCheckTree(copy, __LINE__);
- }
-
- map.setSharable(false);
- sanityCheckTree(map, __LINE__);
- QVERIFY(map.isDetached());
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(map.isDetached());
- QVERIFY(copy.isDetached());
-
- QCOMPARE(copy.size(), 4);
- QCOMPARE(const_(copy)[4], QString("quatro"));
-
- QCOMPARE(map, copy);
- sanityCheckTree(map, __LINE__);
- sanityCheckTree(copy, __LINE__);
- }
-
- map.setSharable(true);
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(!map.isDetached());
- QVERIFY(copy.isSharedWith(map));
- }
-#endif
-}
-
void tst_QMap::insert()
{
QMap<QString, float> map;
@@ -1414,17 +1351,16 @@ void tst_QMap::testInsertMultiWithHint()
{
QMap<int, int> map;
- typedef QMap<int, int>::const_iterator cite; // Hack since we define QT_STRICT_ITERATORS
- map.insertMulti(cite(map.end()), 64, 65);
+ map.insertMulti(map.end(), 64, 65);
map[128] = 129;
map[256] = 257;
sanityCheckTree(map, __LINE__);
- map.insertMulti(cite(map.end()), 512, 513);
- map.insertMulti(cite(map.end()), 512, 513 * 2);
+ map.insertMulti(map.end(), 512, 513);
+ map.insertMulti(map.end(), 512, 513 * 2);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 5);
- map.insertMulti(cite(map.end()), 256, 258); // wrong hint
+ map.insertMulti(map.end(), 256, 258); // wrong hint
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 6);
@@ -1436,23 +1372,23 @@ void tst_QMap::testInsertMultiWithHint()
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 8);
- j = map.insertMulti(cite(j), 68, 259);
+ j = map.insertMulti(j, 68, 259);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 9);
- j = map.insertMulti(cite(j), 67, 67);
+ j = map.insertMulti(j, 67, 67);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 10);
- i = map.insertMulti(cite(i), 256, 259);
+ i = map.insertMulti(i, 256, 259);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 11);
- i = map.insertMulti(cite(i), 256, 260);
+ i = map.insertMulti(i, 256, 260);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 12);
- map.insertMulti(cite(i), 64, 67);
+ map.insertMulti(i, 64, 67);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 13);
diff --git a/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro b/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro
deleted file mode 100644
index 6c1f4727c1..0000000000
--- a/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qmap/qmap.pro)
-TARGET = tst_qmap_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QMap=tst_QMap_StrictIterators
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index 8a545712a2..6638ad8b60 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -26,8 +26,6 @@
**
****************************************************************************/
-//#define QT_STRICT_ITERATORS
-
#include <QtTest/QtTest>
#include <qset.h>
#include <qdebug.h>
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index a1d0100f96..6220cc766a 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -827,7 +827,7 @@ void tst_QVarLengthArray::operators()
// +=: not provided, emulate
//myvla += myvlatwo;
- Q_FOREACH (const QString &s, myvlatwo)
+ for (const QString &s : qAsConst(myvlatwo))
myvla.push_back(s);
QCOMPARE(myvla, combined);
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index 08d5a8cd50..7a69e844d4 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -104,7 +104,7 @@ private:
static void check(const State state1, const State state2)
{
- QCOMPARE(state1, state2);
+ QCOMPARE(int(state1), int(state2));
}
};
@@ -174,7 +174,7 @@ private:
{
// check if c object has been moved
QCOMPARE(c, c->that);
- QCOMPARE(c->state, Constructed);
+ QCOMPARE(int(c->state), int(Constructed));
}
};
QAtomicInt Custom::counter = 0;
@@ -307,22 +307,11 @@ private slots:
void reserve();
void reserveZero();
- void reallocAfterCopy_data();
- void reallocAfterCopy();
void initializeListInt();
void initializeListMovable();
void initializeListCustom();
void const_shared_null();
-#if 1
- // ### Qt6 remove this section
- void setSharableInt_data();
- void setSharableInt();
- void setSharableMovable_data();
- void setSharableMovable();
- void setSharableCustom_data();
- void setSharableCustom();
-#endif
void detachInt() const;
void detachMovable() const;
@@ -358,8 +347,6 @@ private:
template<typename T> void size() const;
template<typename T> void swap() const;
template<typename T> void initializeList();
- template<typename T> void setSharable_data() const;
- template<typename T> void setSharable() const;
template<typename T> void detach() const;
template<typename T> void detachThreadSafety() const;
};
@@ -467,24 +454,6 @@ void tst_QVector::copyConstructor() const
QVector<T> v2(v1);
QCOMPARE(v1, v2);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v1;
- v1.setSharable(false);
- QVector<T> v2(v1);
- QVERIFY(!v1.isSharedWith(v2));
- QCOMPARE(v1, v2);
- }
- {
- QVector<T> v1;
- v1 << value1 << value2 << value3 << value4;
- v1.setSharable(false);
- QVector<T> v2(v1);
- QVERIFY(!v1.isSharedWith(v2));
- QCOMPARE(v1, v2);
- }
-#endif
}
void tst_QVector::copyConstructorInt() const
@@ -665,17 +634,6 @@ void tst_QVector::append() const
QVERIFY(v.size() == 3);
QCOMPARE(v.at(v.size() - 1), SimpleValue<T>::at(0));
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v(2);
- v.reserve(12);
- v.setSharable(false);
- v.append(SimpleValue<T>::at(0));
- QVERIFY(v.size() == 3);
- QCOMPARE(v.last(), SimpleValue<T>::at(0));
- }
-#endif
{
QVector<int> v;
v << 1 << 2 << 3;
@@ -766,16 +724,12 @@ void tst_QVector::capacity() const
myvec.remove(3);
myvec.remove(3);
myvec.remove(3);
- // TODO: is this a safe assumption? presumably it won't release memory until shrink(), but can we asser that is true?
- QVERIFY(myvec.capacity() >= 6);
myvec.squeeze();
QVERIFY(myvec.capacity() >= 3);
myvec.remove(0);
myvec.remove(0);
myvec.remove(0);
- // TODO: as above note
- QVERIFY(myvec.capacity() >= 3);
myvec.squeeze();
QVERIFY(myvec.capacity() == 0);
}
@@ -1019,20 +973,9 @@ void tst_QVector::endsWith() const
template<typename T>
void tst_QVector::eraseEmpty() const
{
- {
- QVector<T> v;
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v;
- v.setSharable(false);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#endif
+ QVector<T> v;
+ v.erase(v.begin(), v.end());
+ QCOMPARE(v.size(), 0);
}
void tst_QVector::eraseEmptyInt() const
@@ -1057,22 +1000,10 @@ void tst_QVector::eraseEmptyCustom() const
template<typename T>
void tst_QVector::eraseEmptyReserved() const
{
- {
- QVector<T> v;
- v.reserve(10);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v;
- v.reserve(10);
- v.setSharable(false);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#endif
+ QVector<T> v;
+ v.reserve(10);
+ v.erase(v.begin(), v.end());
+ QCOMPARE(v.size(), 0);
}
void tst_QVector::eraseEmptyReservedInt() const
@@ -1179,21 +1110,6 @@ void tst_QVector::erase(bool shared) const
if (shared)
QCOMPARE(SimpleValue<T>::vector(12), *svc.copy);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v = SimpleValue<T>::vector(10);
- SharedVectorChecker<T> svc(v, shared);
- v.setSharable(false);
- SharedVectorChecker<T> svc2(v, shared);
- v.erase(v.begin() + 3);
- QCOMPARE(v.size(), 9);
- v.erase(v.begin(), v.end() - 1);
- QCOMPARE(v.size(), 1);
- if (shared)
- QCOMPARE(SimpleValue<T>::vector(10), *svc.copy);
- }
-#endif
}
void tst_QVector::eraseInt() const
@@ -1266,18 +1182,6 @@ template<typename T> void tst_QVector::eraseReserved() const
v.erase(v.begin() + 1, v.end() - 1);
QCOMPARE(v.size(), 2);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v(10);
- v.reserve(16);
- v.setSharable(false);
- v.erase(v.begin() + 3);
- QCOMPARE(v.size(), 9);
- v.erase(v.begin(), v.end() - 1);
- QCOMPARE(v.size(), 1);
- }
-#endif
}
void tst_QVector::eraseReservedInt() const
@@ -2019,33 +1923,6 @@ void tst_QVector::resizePOD_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<int> nullNotShared;
- QVector<int> emptyNotShared(0, 5);
- QVector<int> emptyReservedNotShared;
- QVector<int> nonEmptyNotShared;
- QVector<int> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << 0 << 1 << 2 << 3 << 4;
- nonEmptyReservedNotShared << 0 << 1 << 2 << 3 << 4 << 5 << 6;
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- QTest::newRow("nullNotShared") << nullNotShared << 10;
- QTest::newRow("emptyNotShared") << emptyNotShared << 10;
- QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10;
- QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10;
- QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10;
-#endif
}
void tst_QVector::resizePOD() const
@@ -2094,33 +1971,6 @@ void tst_QVector::resizeComplexMovable_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<Movable> nullNotShared;
- QVector<Movable> emptyNotShared(0, 'Q');
- QVector<Movable> emptyReservedNotShared;
- QVector<Movable> nonEmptyNotShared;
- QVector<Movable> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << '0' << '1' << '2' << '3' << '4';
- nonEmptyReservedNotShared << '0' << '1' << '2' << '3' << '4' << '5' << '6';
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- QTest::newRow("nullNotShared") << nullNotShared << 10;
- QTest::newRow("emptyNotShared") << emptyNotShared << 10;
- QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10;
- QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10;
- QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10;
-#endif
}
void tst_QVector::resizeComplexMovable() const
@@ -2173,33 +2023,6 @@ void tst_QVector::resizeComplex_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<Custom> nullNotShared;
- QVector<Custom> emptyNotShared(0, '0');
- QVector<Custom> emptyReservedNotShared;
- QVector<Custom> nonEmptyNotShared;
- QVector<Custom> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << '0' << '1' << '2' << '3' << '4';
- nonEmptyReservedNotShared << '0' << '1' << '2' << '3' << '4' << '5' << '6';
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- QTest::newRow("nullNotShared") << nullNotShared << 10;
- QTest::newRow("emptyNotShared") << emptyNotShared << 10;
- QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10;
- QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10;
- QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10;
-#endif
}
void tst_QVector::resizeComplex() const
@@ -2512,87 +2335,6 @@ void tst_QVector::reserveZero()
QVERIFY(vec.capacity() >= 1);
}
-// This is a regression test for QTBUG-11763, where memory would be reallocated
-// soon after copying a QVector.
-void tst_QVector::reallocAfterCopy_data()
-{
- QTest::addColumn<int>("capacity");
- QTest::addColumn<int>("fill_size");
- QTest::addColumn<int>("func_id");
- QTest::addColumn<int>("result1");
- QTest::addColumn<int>("result2");
- QTest::addColumn<int>("result3");
- QTest::addColumn<int>("result4");
-
- int result1, result2, result3, result4;
- int fill_size;
- for (int i = 70; i <= 100; i += 10) {
- const QByteArray prefix = "reallocAfterCopy:" + QByteArray::number(i) + ',';
- fill_size = i - 20;
- for (int j = 0; j <= 3; j++) {
- if (j == 0) { // append
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 1) { // insert(0)
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 2) { // insert(20)
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 3) { // insert(0, 10)
- result1 = i;
- result2 = i;
- result3 = i - 10;
- result4 = i - 20;
- }
- QTest::newRow((prefix + QByteArray::number(j)).constData())
- << i << fill_size << j << result1 << result2 << result3 << result4;
- }
- }
-}
-
-void tst_QVector::reallocAfterCopy()
-{
- QFETCH(int, capacity);
- QFETCH(int, fill_size);
- QFETCH(int, func_id);
- QFETCH(int, result1);
- QFETCH(int, result2);
- QFETCH(int, result3);
- QFETCH(int, result4);
-
- QVector<qreal> v1;
- QVector<qreal> v2;
-
- v1.reserve(capacity);
- v1.resize(0);
- v1.fill(qreal(1.0), fill_size);
-
- v2 = v1;
-
- // no need to test begin() and end(), there is a detach() in them
- if (func_id == 0) {
- v1.append(qreal(1.0)); //push_back is same as append
- } else if (func_id == 1) {
- v1.insert(0, qreal(1.0)); //push_front is same as prepend, insert(0)
- } else if (func_id == 2) {
- v1.insert(20, qreal(1.0));
- } else if (func_id == 3) {
- v1.insert(0, 10, qreal(1.0));
- }
-
- QCOMPARE(v1.capacity(), result1);
- QCOMPARE(v2.capacity(), result2);
- QCOMPARE(v1.size(), result3);
- QCOMPARE(v2.size(), result4);
-}
-
template<typename T>
void tst_QVector::initializeList()
{
@@ -2636,154 +2378,9 @@ void tst_QVector::initializeListCustom()
void tst_QVector::const_shared_null()
{
QVector<int> v2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<int> v1;
- v1.setSharable(false);
- QVERIFY(v1.isDetached());
-
- v2.setSharable(true);
-#endif
QVERIFY(!v2.isDetached());
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
-// ### Qt6 remove this section
-template<typename T>
-void tst_QVector::setSharable_data() const
-{
- QTest::addColumn<QVector<T> >("vector");
- QTest::addColumn<int>("size");
- QTest::addColumn<int>("capacity");
- QTest::addColumn<bool>("isCapacityReserved");
-
- QVector<T> null;
- QVector<T> empty(0, SimpleValue<T>::at(1));
- QVector<T> emptyReserved;
- QVector<T> nonEmpty;
- QVector<T> nonEmptyReserved;
-
- emptyReserved.reserve(10);
- nonEmptyReserved.reserve(15);
-
- nonEmpty << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2) << SimpleValue<T>::at(3) << SimpleValue<T>::at(4);
- nonEmptyReserved << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2) << SimpleValue<T>::at(3) << SimpleValue<T>::at(4) << SimpleValue<T>::at(5) << SimpleValue<T>::at(6);
-
- QVERIFY(emptyReserved.capacity() >= 10);
- QVERIFY(nonEmptyReserved.capacity() >= 15);
-
- QTest::newRow("null") << null << 0 << 0 << false;
- QTest::newRow("empty") << empty << 0 << 0 << false;
- QTest::newRow("empty, Reserved") << emptyReserved << 0 << 10 << true;
- QTest::newRow("non-empty") << nonEmpty << 5 << 0 << false;
- QTest::newRow("non-empty, Reserved") << nonEmptyReserved << 7 << 15 << true;
-}
-
-template<typename T>
-void tst_QVector::setSharable() const
-{
- QFETCH(QVector<T>, vector);
- QFETCH(int, size);
- QFETCH(int, capacity);
- QFETCH(bool, isCapacityReserved);
-
- QVERIFY(!vector.isDetached()); // Shared with QTest
-
- vector.setSharable(true);
-
- QCOMPARE(vector.size(), size);
- if (isCapacityReserved)
- QVERIFY2(vector.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .arg(vector.capacity())
- .arg(capacity)));
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(vector));
- }
-
- vector.setSharable(false);
- QVERIFY(vector.isDetached() || vector.isSharedWith(QVector<T>()));
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(copy.isDetached() || copy.isEmpty() || copy.isSharedWith(QVector<T>()));
- QCOMPARE(copy.size(), size);
- if (isCapacityReserved)
- QVERIFY2(copy.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .arg(copy.capacity())
- .arg(capacity)));
- QCOMPARE(copy, vector);
- }
-
- vector.setSharable(true);
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(vector));
- }
-
- for (int i = 0; i < vector.size(); ++i)
- QCOMPARE(vector[i], SimpleValue<T>::at(i));
-
- QCOMPARE(vector.size(), size);
- if (isCapacityReserved)
- QVERIFY2(vector.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .arg(vector.capacity())
- .arg(capacity)));
-}
-#else
-template<typename T> void tst_QVector::setSharable_data() const
-{
-}
-
-template<typename T> void tst_QVector::setSharable() const
-{
-}
-#endif
-
-void tst_QVector::setSharableInt_data()
-{
- setSharable_data<int>();
-}
-
-void tst_QVector::setSharableMovable_data()
-{
- setSharable_data<Movable>();
-}
-
-void tst_QVector::setSharableCustom_data()
-{
- setSharable_data<Custom>();
-}
-
-void tst_QVector::setSharableInt()
-{
- setSharable<int>();
-}
-
-void tst_QVector::setSharableMovable()
-{
- const int instancesCount = Movable::counter.loadAcquire();
- setSharable<Movable>();
- QCOMPARE(instancesCount, Movable::counter.loadAcquire());
-}
-
-void tst_QVector::setSharableCustom()
-{
- const int instancesCount = Custom::counter.loadAcquire();
- setSharable<Custom>();
- QCOMPARE(instancesCount, Custom::counter.loadAcquire());
-}
-
template<typename T>
void tst_QVector::detach() const
{
@@ -2791,7 +2388,7 @@ void tst_QVector::detach() const
// detach an empty vector
QVector<T> v;
v.detach();
- QVERIFY(v.isDetached());
+ QVERIFY(!v.isDetached());
QCOMPARE(v.size(), 0);
QCOMPARE(v.capacity(), 0);
}
@@ -2801,7 +2398,7 @@ void tst_QVector::detach() const
QVector<T> ref(v);
QVERIFY(!v.isDetached());
v.detach();
- QVERIFY(v.isDetached());
+ QVERIFY(!v.isDetached());
QCOMPARE(v.size(), 0);
QCOMPARE(v.capacity(), 0);
}
diff --git a/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro b/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro
deleted file mode 100644
index d6cad86aac..0000000000
--- a/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qvector/qvector.pro)
-TARGET = tst_qvector_strictiterators
-DEFINES += QT_STRICT_ITERATORS=1 tst_QVector=tst_QVector_StrictIterators
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index 49b2a1f075..5a7c8478f1 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -4,7 +4,6 @@ SUBDIRS=\
containerapisymmetry \
qalgorithms \
qarraydata \
- qarraydata_strictiterators \
qbitarray \
qcache \
qcommandlineparser \
@@ -14,15 +13,11 @@ SUBDIRS=\
qexplicitlyshareddatapointer \
qfreelist \
qhash \
- qhash_strictiterators \
qhashfunctions \
qline \
qlinkedlist \
- qlist \
- qlist_strictiterators \
qmakearray \
qmap \
- qmap_strictiterators \
qmargins \
qmessageauthenticationcode \
qoffsetstringarray \
@@ -43,7 +38,6 @@ SUBDIRS=\
qtimeline \
qvarlengtharray \
qvector \
- qvector_strictiterators \
qversionnumber
darwin: SUBDIRS += qmacautoreleasepool
diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
index 05480c6dd2..5453d9de61 100644
--- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp
@@ -31,6 +31,7 @@
#include <qcoreapplication.h>
#include <qmetatype.h>
#include <QtTest/QtTest>
+#include <QtCore/qregularexpression.h>
#include <QtCore/qvariant.h>
#include <QtDBus/QtDBus>
#include <QtDBus/private/qdbus_symbols_p.h>
@@ -451,14 +452,16 @@ void tst_QDBusInterface::introspectVirtualObject()
QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, "org.freedesktop.DBus.Introspectable", "Introspect");
QDBusMessage reply = con.call(message, QDBus::Block, 5000);
QVERIFY(reply.arguments().at(0).toString().contains(
- QRegExp("<node>.*zitroneneis.*<interface name=") ));
+ QRegularExpression("<node>.*zitroneneis.*<interface name=",
+ QRegularExpression::DotMatchesEverythingOption)));
QDBusMessage message2 = QDBusMessage::createMethodCall(con.baseService(), path + "/foo", "org.freedesktop.DBus.Introspectable", "Introspect");
QDBusMessage reply2 = con.call(message2, QDBus::Block, 5000);
QVERIFY(reply2.arguments().at(0).toString().contains(
- QRegExp("<node>.*<interface name=\"org.qtproject.QtDBus.VirtualObject\">"
- ".*<method name=\"klingeling\" />\n"
- ".*</interface>.*<interface name=") ));
+ QRegularExpression("<node>.*<interface name=\"org.qtproject.QtDBus.VirtualObject\">"
+ ".*<method name=\"klingeling\" />\n"
+ ".*</interface>.*<interface name=",
+ QRegularExpression::DotMatchesEverythingOption)));
}
void tst_QDBusInterface::callMethod()
diff --git a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp
index 4b926dcd05..ec3e71ac8f 100644
--- a/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp
+++ b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp
@@ -402,7 +402,7 @@ void tst_QDBusMetaType::invalidTypes()
else if (qstrcmp(QTest::currentDataTag(), "Invalid7") == 0)
QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `Invalid7' produces invalid D-BUS signature `()' (Did you forget to call beginStructure() ?)");
else if (qstrcmp(QTest::currentDataTag(), "QList<Invalid0>") == 0)
- QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `QList<Invalid0>' produces invalid D-BUS signature `a' (Did you forget to call beginStructure() ?)");
+ QTest::ignoreMessage(QtWarningMsg, "QDBusMarshaller: type `QVector<Invalid0>' produces invalid D-BUS signature `a' (Did you forget to call beginStructure() ?)");
staticTypes();
staticTypes(); // run twice: the error messages should be printed once only
diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
index ec6bb8dcee..6287960457 100644
--- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp
+++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
@@ -37,6 +37,8 @@
#include <qscreen.h>
#include <limits.h>
+#ifndef QT_NO_PICTURE
+
class tst_QPicture : public QObject
{
Q_OBJECT
@@ -45,7 +47,6 @@ public:
tst_QPicture();
private slots:
- void getSetCheck();
void devType();
void paintingActive();
void boundingRect();
@@ -56,31 +57,6 @@ private slots:
void boundaryValues();
};
-// Testing get/set functions
-void tst_QPicture::getSetCheck()
-{
- QPictureIO obj1;
- // const QPicture & QPictureIO::picture()
- // void QPictureIO::setPicture(const QPicture &)
- // const char * QPictureIO::format()
- // void QPictureIO::setFormat(const char *)
- const char var2[] = "PNG";
- obj1.setFormat(var2);
- QCOMPARE(var2, obj1.format());
- obj1.setFormat((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.format()).isEmpty());
-
- // const char * QPictureIO::parameters()
- // void QPictureIO::setParameters(const char *)
- const char var3[] = "Bogus data";
- obj1.setParameters(var3);
- QCOMPARE(var3, obj1.parameters());
- obj1.setParameters((char *)0);
- // The format is stored internally in a QString, so return is always a valid char *
- QVERIFY(QString(obj1.parameters()).isEmpty());
-}
-
tst_QPicture::tst_QPicture()
{
}
@@ -316,6 +292,7 @@ void tst_QPicture::boundaryValues()
painter.end();
}
-
QTEST_MAIN(tst_QPicture)
#include "tst_qpicture.moc"
+
+#endif // QT_NO_PICTURE
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 42135dae24..106e9050b8 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -4,11 +4,14 @@ SUBDIRS=\
qclipboard \
qcursor \
qdrag \
+ qguiaction \
+ qguiactiongroup \
qevent \
qfileopenevent \
qguieventdispatcher \
qguieventloop \
qguimetatype \
+ qguishortcut \
qguitimer \
qguivariant \
qhighdpiscaling \
@@ -29,6 +32,12 @@ SUBDIRS=\
win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
+!qtConfig(shortcut): SUBDIRS -= \
+ qkeysequence \
+ qguishortcut \
+ qguimetatype \
+ qguivariant
+
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
qtouchevent
@@ -36,6 +45,10 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(network): SUBDIRS -= \
qguieventloop
+!qtConfig(action): SUBDIRS -= \
+ qguiaction \
+ qguiactiongroup
+
!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling
!qtConfig(opengl): SUBDIRS -= qopenglwindow
diff --git a/tests/auto/widgets/kernel/qaction/.gitignore b/tests/auto/gui/kernel/qguiaction/.gitignore
index bf81f5bf2c..bf81f5bf2c 100644
--- a/tests/auto/widgets/kernel/qaction/.gitignore
+++ b/tests/auto/gui/kernel/qguiaction/.gitignore
diff --git a/tests/auto/gui/kernel/qguiaction/qguiaction.pro b/tests/auto/gui/kernel/qguiaction/qguiaction.pro
new file mode 100644
index 0000000000..2a39636119
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiaction/qguiaction.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qguiaction
+QT += gui-private core-private testlib
+SOURCES += tst_qguiaction.cpp
diff --git a/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp b/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp
new file mode 100644
index 0000000000..9d45d4ae14
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiaction/tst_qguiaction.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qguiapplication.h>
+#include <qevent.h>
+#include <qguiaction.h>
+#include <qguiactiongroup.h>
+#include <qpa/qplatformtheme.h>
+
+#include <private/qguiapplication_p.h>
+
+class tst_QGuiAction : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGuiAction();
+
+private slots:
+ void cleanup();
+ void getSetCheck();
+ void setText_data();
+ void setText();
+ void setIconText_data() { setText_data(); }
+ void setIconText();
+#if QT_CONFIG(shortcut)
+ void setStandardKeys();
+ void task200823_tooltip();
+#endif
+ void task229128TriggeredSignalWithoutActiongroup();
+ void setData();
+
+private:
+ const int m_keyboardScheme;
+};
+
+tst_QGuiAction::tst_QGuiAction()
+ : m_keyboardScheme(QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt())
+{
+}
+
+void tst_QGuiAction::cleanup()
+{
+ QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
+}
+
+// Testing get/set functions
+void tst_QGuiAction::getSetCheck()
+{
+ QGuiAction obj1(nullptr);
+ // QActionGroup * QAction::actionGroup()
+ // void QAction::setActionGroup(QActionGroup *)
+ auto var1 = new QGuiActionGroup(nullptr);
+ obj1.setActionGroup(var1);
+ QCOMPARE(var1, obj1.guiActionGroup());
+ obj1.setActionGroup(nullptr);
+ QCOMPARE(obj1.guiActionGroup(), nullptr);
+ delete var1;
+
+ QCOMPARE(obj1.priority(), QGuiAction::NormalPriority);
+ obj1.setPriority(QGuiAction::LowPriority);
+ QCOMPARE(obj1.priority(), QGuiAction::LowPriority);
+}
+
+void tst_QGuiAction::setText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("iconText");
+ QTest::addColumn<QString>("textFromIconText");
+
+ //next we fill it with data
+ QTest::newRow("Normal") << "Action" << "Action" << "Action";
+ QTest::newRow("Ampersand") << "Search && Destroy" << "Search & Destroy" << "Search && Destroy";
+ QTest::newRow("Mnemonic and ellipsis") << "O&pen File ..." << "Open File" << "Open File";
+}
+
+void tst_QGuiAction::setText()
+{
+ QFETCH(QString, text);
+
+ QGuiAction action(nullptr);
+ action.setText(text);
+
+ QCOMPARE(action.text(), text);
+
+ QFETCH(QString, iconText);
+ QCOMPARE(action.iconText(), iconText);
+}
+
+void tst_QGuiAction::setIconText()
+{
+ QFETCH(QString, iconText);
+
+ QGuiAction action(nullptr);
+ action.setIconText(iconText);
+ QCOMPARE(action.iconText(), iconText);
+
+ QFETCH(QString, textFromIconText);
+ QCOMPARE(action.text(), textFromIconText);
+}
+
+#if QT_CONFIG(shortcut)
+
+//basic testing of standard keys
+void tst_QGuiAction::setStandardKeys()
+{
+ QGuiAction act(nullptr);
+ act.setShortcut(QKeySequence("CTRL+L"));
+ QList<QKeySequence> list;
+ act.setShortcuts(list);
+ act.setShortcuts(QKeySequence::Copy);
+ QCOMPARE(act.shortcut(), act.shortcuts().constFirst());
+
+ QList<QKeySequence> expected;
+ const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
+ const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
+ switch (m_keyboardScheme) {
+ case QPlatformTheme::MacKeyboardScheme:
+ expected << ctrlC;
+ break;
+ case QPlatformTheme::WindowsKeyboardScheme:
+ expected << ctrlC << ctrlInsert;
+ break;
+ default: // X11
+ expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16"));
+ break;
+ }
+
+ QCOMPARE(act.shortcuts(), expected);
+}
+
+void tst_QGuiAction::task200823_tooltip()
+{
+ const QScopedPointer<QGuiAction> action(new QGuiAction("foo", nullptr));
+ QString shortcut("ctrl+o");
+ action->setShortcut(shortcut);
+
+ // we want a non-standard tooltip that shows the shortcut
+ action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')'));
+
+ QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')');
+ QCOMPARE(action->toolTip(), ref);
+}
+
+#endif // QT_CONFIG(shortcut)
+
+void tst_QGuiAction::task229128TriggeredSignalWithoutActiongroup()
+{
+ // test without a group
+ const QScopedPointer<QGuiAction> actionWithoutGroup(new QGuiAction("Test", nullptr));
+ QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), QOverload<bool>::of(&QGuiAction::triggered));
+ QCOMPARE(spyWithoutGroup.count(), 0);
+ actionWithoutGroup->trigger();
+ // signal should be emitted
+ QCOMPARE(spyWithoutGroup.count(), 1);
+
+ // it is now a checkable checked action
+ actionWithoutGroup->setCheckable(true);
+ actionWithoutGroup->setChecked(true);
+ spyWithoutGroup.clear();
+ QCOMPARE(spyWithoutGroup.count(), 0);
+ actionWithoutGroup->trigger();
+ // signal should be emitted
+ QCOMPARE(spyWithoutGroup.count(), 1);
+}
+
+void tst_QGuiAction::setData() // QTBUG-62006
+{
+ QGuiAction act(nullptr);
+ QSignalSpy spy(&act, &QGuiAction::changed);
+ QCOMPARE(act.data(), QVariant());
+ QCOMPARE(spy.count(), 0);
+ act.setData(QVariant());
+ QCOMPARE(spy.count(), 0);
+
+ act.setData(-1);
+ QCOMPARE(spy.count(), 1);
+ act.setData(-1);
+ QCOMPARE(spy.count(), 1);
+}
+
+QTEST_MAIN(tst_QGuiAction)
+#include "tst_qguiaction.moc"
diff --git a/tests/auto/gui/kernel/qguiactiongroup/.gitignore b/tests/auto/gui/kernel/qguiactiongroup/.gitignore
new file mode 100644
index 0000000000..daba003e96
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/.gitignore
@@ -0,0 +1 @@
+tst_qactiongroup
diff --git a/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro b/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro
new file mode 100644
index 0000000000..7fd64e70f1
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/qguiactiongroup.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qactiongroup
+QT += testlib
+SOURCES += tst_qguiactiongroup.cpp
diff --git a/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp b/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp
new file mode 100644
index 0000000000..1ac14280fb
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiactiongroup/tst_qguiactiongroup.cpp
@@ -0,0 +1,235 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <qguiaction.h>
+#include <qguiactiongroup.h>
+
+class tst_QGuiActionGroup : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void cleanup() { QVERIFY(QGuiApplication::topLevelWindows().isEmpty()); }
+ void enabledPropagation();
+ void visiblePropagation();
+ void exclusive();
+ void exclusiveOptional();
+ void testActionInTwoQActionGroup();
+ void unCheckCurrentAction();
+};
+
+void tst_QGuiActionGroup::enabledPropagation()
+{
+ QGuiActionGroup testActionGroup(nullptr);
+
+ auto childAction = new QGuiAction( &testActionGroup );
+ auto anotherChildAction = new QGuiAction( &testActionGroup );
+ auto freeAction = new QGuiAction(nullptr);
+
+ QVERIFY( testActionGroup.isEnabled() );
+ QVERIFY( childAction->isEnabled() );
+
+ testActionGroup.setEnabled( false );
+ QVERIFY( !testActionGroup.isEnabled() );
+ QVERIFY( !childAction->isEnabled() );
+ QVERIFY( !anotherChildAction->isEnabled() );
+
+ childAction->setEnabled(true);
+ QVERIFY( !childAction->isEnabled());
+
+ anotherChildAction->setEnabled( false );
+
+ testActionGroup.setEnabled( true );
+ QVERIFY( testActionGroup.isEnabled() );
+ QVERIFY( childAction->isEnabled() );
+ QVERIFY( !anotherChildAction->isEnabled() );
+
+ testActionGroup.setEnabled( false );
+ auto lastChildAction = new QGuiAction(&testActionGroup);
+
+ QVERIFY(!lastChildAction->isEnabled());
+ testActionGroup.setEnabled( true );
+ QVERIFY(lastChildAction->isEnabled());
+
+ freeAction->setEnabled(false);
+ testActionGroup.addAction(freeAction);
+ QVERIFY(!freeAction->isEnabled());
+ delete freeAction;
+}
+
+void tst_QGuiActionGroup::visiblePropagation()
+{
+ QGuiActionGroup testActionGroup(nullptr);
+
+ auto childAction = new QGuiAction( &testActionGroup );
+ auto anotherChildAction = new QGuiAction( &testActionGroup );
+ auto freeAction = new QGuiAction(nullptr);
+
+ QVERIFY( testActionGroup.isVisible() );
+ QVERIFY( childAction->isVisible() );
+
+ testActionGroup.setVisible( false );
+ QVERIFY( !testActionGroup.isVisible() );
+ QVERIFY( !childAction->isVisible() );
+ QVERIFY( !anotherChildAction->isVisible() );
+
+ anotherChildAction->setVisible(false);
+
+ testActionGroup.setVisible( true );
+ QVERIFY( testActionGroup.isVisible() );
+ QVERIFY( childAction->isVisible() );
+
+ QVERIFY( !anotherChildAction->isVisible() );
+
+ testActionGroup.setVisible( false );
+ auto lastChildAction = new QGuiAction(&testActionGroup);
+
+ QVERIFY(!lastChildAction->isVisible());
+ testActionGroup.setVisible( true );
+ QVERIFY(lastChildAction->isVisible());
+
+ freeAction->setVisible(false);
+ testActionGroup.addAction(freeAction);
+ QVERIFY(!freeAction->isVisible());
+ delete freeAction;
+}
+
+void tst_QGuiActionGroup::exclusive()
+{
+ QGuiActionGroup group(nullptr);
+ group.setExclusive(false);
+ QVERIFY( !group.isExclusive() );
+
+ auto actOne = new QGuiAction(&group);
+ actOne->setCheckable( true );
+ auto actTwo = new QGuiAction(&group);
+ actTwo->setCheckable( true );
+ auto actThree = new QGuiAction(&group);
+ actThree->setCheckable( true );
+
+ group.setExclusive( true );
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->setChecked( true );
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->setChecked( true );
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+}
+
+void tst_QGuiActionGroup::exclusiveOptional()
+{
+ QGuiActionGroup group(0);
+ group.setExclusive(true);
+ QVERIFY( group.isExclusive() );
+
+ auto actOne = new QGuiAction(&group);
+ actOne->setCheckable( true );
+ auto actTwo = new QGuiAction(&group);
+ actTwo->setCheckable( true );
+ auto actThree = new QGuiAction(&group);
+ actThree->setCheckable( true );
+
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ group.setExclusionPolicy(QGuiActionGroup::ExclusionPolicy::ExclusiveOptional);
+ QVERIFY( group.isExclusive() );
+
+ actOne->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+}
+
+void tst_QGuiActionGroup::testActionInTwoQActionGroup()
+{
+ QGuiAction action1("Action 1", this);
+
+ QGuiActionGroup group1(this);
+ QGuiActionGroup group2(this);
+
+ group1.addAction(&action1);
+ group2.addAction(&action1);
+
+ QCOMPARE(action1.guiActionGroup(), &group2);
+ QCOMPARE(group2.guiActions().constFirst(), &action1);
+ QCOMPARE(group1.guiActions().isEmpty(), true);
+}
+
+void tst_QGuiActionGroup::unCheckCurrentAction()
+{
+ QGuiActionGroup group(nullptr);
+ QGuiAction action1(&group) ,action2(&group);
+ action1.setCheckable(true);
+ action2.setCheckable(true);
+ QVERIFY(!action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ action1.setChecked(true);
+ QVERIFY(action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ auto current = group.checkedGuiAction();
+ QCOMPARE(current, &action1);
+ current->setChecked(false);
+ QVERIFY(!action1.isChecked());
+ QVERIFY(!action2.isChecked());
+ QVERIFY(!group.checkedGuiAction());
+}
+
+
+QTEST_MAIN(tst_QGuiActionGroup)
+#include "tst_qguiactiongroup.moc"
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 3ce65a6785..2645bb111e 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -181,9 +181,13 @@ template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
#endif
+
+#if QT_CONFIG(shortcut)
template<> struct TestValueFactory<QMetaType::QKeySequence> {
static QKeySequence *create() { return new QKeySequence(QKeySequence::Close); }
};
+#endif
+
template<> struct TestValueFactory<QMetaType::QPen> {
static QPen *create() { return new QPen(Qt::DashDotDotLine); }
};
@@ -312,30 +316,10 @@ void tst_QGuiMetaType::sizeOf()
QCOMPARE(QMetaType::sizeOf(type), size);
}
-#ifndef Q_ALIGNOF
-template<uint N>
-struct RoundToNextHighestPowerOfTwo
-{
-private:
- enum { V1 = N-1 };
- enum { V2 = V1 | (V1 >> 1) };
- enum { V3 = V2 | (V2 >> 2) };
- enum { V4 = V3 | (V3 >> 4) };
- enum { V5 = V4 | (V4 >> 8) };
- enum { V6 = V5 | (V5 >> 16) };
-public:
- enum { Value = V6 + 1 };
-};
-#endif
-
template<class T>
struct TypeAlignment
{
-#ifdef Q_ALIGNOF
- enum { Value = Q_ALIGNOF(T) };
-#else
- enum { Value = RoundToNextHighestPowerOfTwo<sizeof(T)>::Value };
-#endif
+ enum { Value = alignof(T) };
};
void tst_QGuiMetaType::flags_data()
diff --git a/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro b/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro
new file mode 100644
index 0000000000..1417dee213
--- /dev/null
+++ b/tests/auto/gui/kernel/qguishortcut/qguishortcut.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qguishortcut
+QT += testlib
+SOURCES += tst_qguishortcut.cpp
diff --git a/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp b/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp
new file mode 100644
index 0000000000..bc3fb9862d
--- /dev/null
+++ b/tests/auto/gui/kernel/qguishortcut/tst_qguishortcut.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qguishortcut.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qrasterwindow.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qwindow.h>
+
+class tst_QGuiShortcut : public QObject
+{
+ Q_OBJECT
+public:
+
+private slots:
+ void trigger();
+};
+
+class ColoredWindow : public QRasterWindow {
+public:
+ ColoredWindow(QColor c) : m_color(c) {}
+
+protected:
+ void paintEvent(QPaintEvent *event) override;
+
+private:
+ const QColor m_color;
+};
+
+void ColoredWindow::paintEvent(QPaintEvent *)
+{
+ QPainter p(this);
+ p.fillRect(QRect(QPoint(), size()), m_color);
+}
+
+static void sendKey(QWindow *target, Qt::Key k, char c, Qt::KeyboardModifiers modifiers)
+{
+ QTest::sendKeyEvent(QTest::Press, target, k, c, modifiers);
+ QTest::sendKeyEvent(QTest::Release, target, k, c, modifiers);
+}
+
+void tst_QGuiShortcut::trigger()
+{
+ ColoredWindow w(Qt::yellow);
+ w.setTitle(QTest::currentTestFunction());
+ w.resize(QGuiApplication::primaryScreen()->size() / 4);
+ new QGuiShortcut(Qt::CTRL + Qt::Key_Q, &w, SLOT(close()));
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ sendKey(&w, Qt::Key_Q, 'q', Qt::ControlModifier);
+ QTRY_VERIFY(!w.isVisible());
+}
+
+QTEST_MAIN(tst_QGuiShortcut)
+#include "tst_qguishortcut.moc"
diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
index 87a47bd93b..6a928cac7a 100644
--- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp
@@ -64,8 +64,10 @@ public:
private slots:
void basicEventDelivery();
+#if QT_CONFIG(shortcut)
void modifiers_data();
void modifiers();
+#endif
};
tst_QKeyEvent::tst_QKeyEvent()
@@ -128,6 +130,8 @@ static QByteArray modifiersTestRowName(const QString &keySequence)
return result;
}
+#if QT_CONFIG(shortcut)
+
void tst_QKeyEvent::modifiers_data()
{
struct Modifier
@@ -198,5 +202,7 @@ void tst_QKeyEvent::modifiers()
}
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QKeyEvent)
#include "tst_qkeyevent.moc"
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 07c820dc86..f8502c1e2f 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -1032,6 +1032,15 @@ void tst_QColor::setRgbF()
QCOMPARE(qfloat16(b2), qfloat16(b));
}
}
+ QVERIFY(color.isValid());
+ QColor invalidRgb = color;
+ QColor invalidRgbF = color;
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setRgb: RGB parameters out of range");
+ invalidRgb.setRgb(-1, -1, -1);
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setRgb: RGB parameters out of range");
+ invalidRgbF.setRgb(-1, -1, -1, -1);
+ QVERIFY(!invalidRgb.isValid());
+ QVERIFY(!invalidRgbF.isValid());
}
void tst_QColor::setRgba()
@@ -1146,6 +1155,16 @@ void tst_QColor::setHsv()
QCOMPARE(v2, v);
}
}
+ QVERIFY(color.isValid());
+ QVERIFY(color.isValid());
+ QColor invalidHsv = color;
+ QColor invalidHsvF = color;
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setHsv: HSV parameters out of range");
+ invalidHsv.setHsv(-1, -1, -1);
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setHsvF: HSV parameters out of range");
+ invalidHsvF.setHsvF(-1, -1, -1);
+ QVERIFY(!invalidHsv.isValid());
+ QVERIFY(!invalidHsvF.isValid());
}
void tst_QColor::setCmyk()
@@ -1271,6 +1290,15 @@ void tst_QColor::setCmyk()
QCOMPARE(k2, k);
}
}
+ QVERIFY(color.isValid());
+ QColor invalidCmyk = color;
+ QColor invalidCmykF = color;
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setCmyk: CMYK parameters out of range");
+ invalidCmyk.setCmyk(-1, -1, -1, -1, -1);
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setCmykF: CMYK parameters out of range");
+ invalidCmykF.setCmykF(-1, -1, -1, -1, -1);
+ QVERIFY(!invalidCmyk.isValid());
+ QVERIFY(!invalidCmykF.isValid());
}
void tst_QColor::setHsl()
@@ -1372,6 +1400,15 @@ void tst_QColor::setHsl()
QCOMPARE(l2, l);
}
}
+ QVERIFY(color.isValid());
+ QColor invalidHsl = color;
+ QColor invalidHslF = color;
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setHsl: HSL parameters out of range");
+ invalidHsl.setHsl(-1, -1, -1, -1);
+ QTest::ignoreMessage(QtWarningMsg, "QColor::setHslF: HSL parameters out of range");
+ invalidHslF.setHslF(-1, -1, -1, -1);
+ QVERIFY(!invalidHsl.isValid());
+ QVERIFY(!invalidHslF.isValid());
}
void tst_QColor::toRgb_data()
diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro
index b140b5e9f2..d2b4d97b21 100644
--- a/tests/auto/network/access/access.pro
+++ b/tests/auto/network/access/access.pro
@@ -7,7 +7,6 @@ SUBDIRS=\
qnetworkrequest \
qhttpnetworkconnection \
qnetworkreply \
- spdy \
qnetworkcachemetadata \
qftp \
qhttpnetworkreply \
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index 6f94692cb1..904cfd52b0 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -939,13 +939,6 @@ void tst_Http2::replyFinished()
QVERIFY(http2Used.isValid());
QVERIFY(http2Used.toBool());
- const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute));
- if (!spdyUsed.isValid() || spdyUsed.toBool())
- stopEventLoop();
-
- QVERIFY(spdyUsed.isValid());
- QVERIFY(!spdyUsed.toBool());
-
const QVariant code(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute));
if (!code.isValid() || !code.canConvert<int>() || code.value<int>() != 200)
stopEventLoop();
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 2a0651f96f..18450f1853 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -15,8 +15,6 @@ linux
# QTBUG-71953
[getFromHttp]
* !android !winrt
-[getFromHttp:success-external]
-*
[getFromHttpIntoBuffer]
osx
[getFromHttpIntoBuffer2]
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index c523b0c20e..a2b3248ab8 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1914,10 +1914,6 @@ void tst_QNetworkReply::getFromHttp_data()
<< testDataDir + "/rfc3252.txt"
<< "http://" + QtNetworkSettings::httpServerName() + "/qtest/rfc3252.txt";
- QTest::newRow("success-external")
- << testDataDir + "/rfc3252.txt"
- << "http://www.ietf.org/rfc/rfc3252.txt";
-
QTest::newRow("bigfile-internal")
<< testDataDir + "/bigfile"
<< "http://" + QtNetworkSettings::httpServerName() + "/qtest/bigfile";
diff --git a/tests/auto/network/access/spdy/BLACKLIST b/tests/auto/network/access/spdy/BLACKLIST
deleted file mode 100644
index 5cf79327be..0000000000
--- a/tests/auto/network/access/spdy/BLACKLIST
+++ /dev/null
@@ -1,7 +0,0 @@
-[download]
-opensuse-leap
-[upload]
-opensuse-leap
-ubuntu-18.04
-b2qt
-
diff --git a/tests/auto/network/access/spdy/spdy.pro b/tests/auto/network/access/spdy/spdy.pro
deleted file mode 100644
index cdbe60a19b..0000000000
--- a/tests/auto/network/access/spdy/spdy.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_spdy
-SOURCES += tst_spdy.cpp
-
-QT = core core-private network network-private testlib
-
-win32:CONFIG += insignificant_test # QTBUG-47128
diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp
deleted file mode 100644
index f4a5976558..0000000000
--- a/tests/auto/network/access/spdy/tst_spdy.cpp
+++ /dev/null
@@ -1,693 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkReply>
-#include <QtNetwork/QHttpPart>
-#include <QtNetwork/QHttpMultiPart>
-#include <QtNetwork/QNetworkProxy>
-#include <QtNetwork/QAuthenticator>
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_OPENSSL)
-#include <QtNetwork/private/qsslsocket_openssl_p.h>
-#endif // QT_BUILD_INTERNAL && !QT_NO_OPENSSL
-
-#include "../../../network-settings.h"
-
-Q_DECLARE_METATYPE(QAuthenticator*)
-
-class tst_Spdy: public QObject
-{
- Q_OBJECT
-
-public:
- tst_Spdy();
- ~tst_Spdy();
-
-private Q_SLOTS:
- void initTestCase();
- void settingsAndNegotiation_data();
- void settingsAndNegotiation();
-#ifndef QT_NO_NETWORKPROXY
- void download_data();
- void download();
-#endif // !QT_NO_NETWORKPROXY
- void headerFields();
-#ifndef QT_NO_NETWORKPROXY
- void upload_data();
- void upload();
- void errors_data();
- void errors();
-#endif // !QT_NO_NETWORKPROXY
- void multipleRequests_data();
- void multipleRequests();
-
-private:
- QNetworkAccessManager m_manager;
- int m_multipleRequestsCount;
- int m_multipleRepliesFinishedCount;
- const QString m_rfc3252FilePath;
-
-protected Q_SLOTS:
- void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *authenticator);
- void multipleRequestsFinishedSlot();
-};
-
-tst_Spdy::tst_Spdy()
- : m_rfc3252FilePath(QFINDTESTDATA("../qnetworkreply/rfc3252.txt"))
-{
-#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) && OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
- qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy
- qRegisterMetaType<QAuthenticator *>();
-
- connect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)));
-#else
- QSKIP("Qt built withouth OpenSSL, or the OpenSSL version is too old");
-#endif // defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL) ...
-}
-
-tst_Spdy::~tst_Spdy()
-{
-}
-
-void tst_Spdy::initTestCase()
-{
- QVERIFY(!m_rfc3252FilePath.isEmpty());
- QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
-}
-
-void tst_Spdy::settingsAndNegotiation_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<bool>("setAttribute");
- QTest::addColumn<bool>("enabled");
- QTest::addColumn<QByteArray>("expectedProtocol");
- QTest::addColumn<QByteArray>("expectedContent");
-
- QTest::newRow("default-settings") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << false << false << QByteArray()
- << QByteArray("1");
-
- QTest::newRow("http-url") << QUrl("http://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << true << QByteArray()
- << QByteArray("1");
-
- QTest::newRow("spdy-disabled") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << false << QByteArray()
- << QByteArray("1");
-
-#ifndef QT_NO_OPENSSL
- QTest::newRow("spdy-enabled") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/cgi-bin/echo.cgi?1")
- << true << true << QByteArray(QSslConfiguration::NextProtocolSpdy3_0)
- << QByteArray("1");
-#endif // QT_NO_OPENSSL
-}
-
-void tst_Spdy::settingsAndNegotiation()
-{
- QFETCH(QUrl, url);
- QFETCH(bool, setAttribute);
- QFETCH(bool, enabled);
-
- QNetworkRequest request(url);
-
- if (setAttribute) {
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, QVariant(enabled));
- }
-
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QFETCH(QByteArray, expectedProtocol);
-
-#ifndef QT_NO_OPENSSL
- bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), expectedSpdyUsed);
-#endif // QT_NO_OPENSSL
-
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
-
- int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- QCOMPARE(statusCode, 200);
-
- QByteArray content = reply->readAll();
-
- QFETCH(QByteArray, expectedContent);
- QCOMPARE(expectedContent, content);
-
-#ifndef QT_NO_OPENSSL
- QSslConfiguration::NextProtocolNegotiationStatus expectedStatus =
- (expectedProtocol.isEmpty())
- ? QSslConfiguration::NextProtocolNegotiationNone
- : QSslConfiguration::NextProtocolNegotiationNegotiated;
- QCOMPARE(reply->sslConfiguration().nextProtocolNegotiationStatus(),
- expectedStatus);
-
- QCOMPARE(reply->sslConfiguration().nextNegotiatedProtocol(), expectedProtocol);
-#endif // QT_NO_OPENSSL
-}
-
-void tst_Spdy::proxyAuthenticationRequired(const QNetworkProxy &/*proxy*/,
- QAuthenticator *authenticator)
-{
- authenticator->setUser("qsockstest");
- authenticator->setPassword("password");
-}
-
-#ifndef QT_NO_NETWORKPROXY
-void tst_Spdy::download_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QString>("fileName");
- QTest::addColumn<QNetworkProxy>("proxy");
-
- QTest::newRow("mediumfile") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy();
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("mediumfile-http-proxy") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128);
-
- QTest::newRow("mediumfile-http-proxy-auth") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- proxyserver, 3129);
-
- QTest::newRow("mediumfile-socks-proxy") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080);
-
- QTest::newRow("mediumfile-socks-proxy-auth") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/rfc3252.txt")
- << m_rfc3252FilePath
- << QNetworkProxy(QNetworkProxy::Socks5Proxy,
- proxyserver, 1081);
-
- QTest::newRow("bigfile") << QUrl("https://" + QtNetworkSettings::serverName()
- + "/qtest/bigfile")
- << QFINDTESTDATA("../qnetworkreply/bigfile")
- << QNetworkProxy();
-}
-
-void tst_Spdy::download()
-{
- QFETCH(QUrl, url);
- QFETCH(QString, fileName);
- QFETCH(QNetworkProxy, proxy);
-
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy downloadProgressSpy(reply, SIGNAL(downloadProgress(qint64, qint64)));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
- QSignalSpy proxyAuthRequiredSpy(&m_manager, SIGNAL(
- proxyAuthenticationRequired(const QNetworkProxy &,
- QAuthenticator *)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), 1);
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QVERIFY(downloadProgressSpy.count() > 0);
- QVERIFY(readyReadSpy.count() > 0);
-
- QVERIFY(proxyAuthRequiredSpy.count() <= 1);
-
- QCOMPARE(reply->error(), QNetworkReply::NoError);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QFile file(fileName);
- QVERIFY(file.open(QIODevice::ReadOnly));
-
- qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong();
- qint64 expectedContentLength = file.bytesAvailable();
- QCOMPARE(contentLength, expectedContentLength);
-
- QByteArray expectedContent = file.readAll();
- QByteArray content = reply->readAll();
- QCOMPARE(content, expectedContent);
-
- reply->deleteLater();
- m_manager.setProxy(QNetworkProxy()); // reset
-}
-#endif // !QT_NO_NETWORKPROXY
-
-void tst_Spdy::headerFields()
-{
- QUrl url(QUrl("https://" + QtNetworkSettings::serverName()));
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- QNetworkReply *reply = m_manager.get(request);
- reply->ignoreSslErrors();
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(reply->rawHeader("Content-Type"), QByteArray("text/html"));
- QVERIFY(reply->rawHeader("Content-Length").toInt() > 0);
- QVERIFY(reply->rawHeader("server").contains("Apache"));
-
- QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toByteArray(), QByteArray("text/html"));
- QVERIFY(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong() > 0);
- QVERIFY(reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().isValid());
- QVERIFY(reply->header(QNetworkRequest::ServerHeader).toByteArray().contains("Apache"));
-}
-
-static inline QByteArray md5sum(const QByteArray &data)
-{
- return QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex().append('\n');
-}
-
-#ifndef QT_NO_NETWORKPROXY
-void tst_Spdy::upload_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QByteArray>("data");
- QTest::addColumn<QByteArray>("uploadMethod");
- QTest::addColumn<QObject *>("uploadObject");
- QTest::addColumn<QByteArray>("md5sum");
- QTest::addColumn<QNetworkProxy>("proxy");
-
-
- // 1. test uploading of byte arrays
-
- QUrl md5Url("https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi");
-
- QByteArray data;
- data = "";
- QObject *dummyObject = 0;
- QTest::newRow("empty") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = "This is a normal message.";
- QTest::newRow("generic") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = "This is a message to show that Qt rocks!\r\n\n";
- QTest::newRow("small") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray("abcd\0\1\2\abcd",12);
- QTest::newRow("with-nul") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(4097, '\4');
- QTest::newRow("4k+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)<< QNetworkProxy();
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("4k+1-with-http-proxy") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128);
-
- QTest::newRow("4k+1-with-http-proxy-auth") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- proxyserver, 3129);
-
- QTest::newRow("4k+1-with-socks-proxy") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080);
-
- QTest::newRow("4k+1-with-socks-proxy-auth") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data)
- << QNetworkProxy(QNetworkProxy::Socks5Proxy,
- proxyserver, 1081);
-
- data = QByteArray(128*1024+1, '\177');
- QTest::newRow("128k+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(128*1024+1, '\177');
- QTest::newRow("128k+1-put") << md5Url << data << QByteArray("PUT") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
- data = QByteArray(2*1024*1024+1, '\177');
- QTest::newRow("2MB+1") << md5Url << data << QByteArray("POST") << dummyObject
- << md5sum(data) << QNetworkProxy();
-
-
- // 2. test uploading of files
-
- QFile *file = new QFile(m_rfc3252FilePath);
- file->open(QIODevice::ReadOnly);
- QTest::newRow("file-26K") << md5Url << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(file)
- << QByteArray("b3e32ac459b99d3f59318f3ac31e4bee\n") << QNetworkProxy();
-
- QFile *file2 = new QFile(QFINDTESTDATA("../qnetworkreply/image1.jpg"));
- file2->open(QIODevice::ReadOnly);
- QTest::newRow("file-1MB") << md5Url << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(file2)
- << QByteArray("87ef3bb319b004ba9e5e9c9fa713776e\n") << QNetworkProxy();
-
-
- // 3. test uploading of multipart
-
- QUrl multiPartUrl("https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/multipart.cgi");
-
- QHttpPart imagePart31;
- imagePart31.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart31.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage1\""));
- imagePart31.setRawHeader("Content-Location", "http://my.test.location.tld");
- imagePart31.setRawHeader("Content-ID", "my@id.tld");
- QFile *file31 = new QFile(QFINDTESTDATA("../qnetworkreply/image1.jpg"));
- file31->open(QIODevice::ReadOnly);
- imagePart31.setBodyDevice(file31);
- QHttpMultiPart *imageMultiPart3 = new QHttpMultiPart(QHttpMultiPart::FormDataType);
- imageMultiPart3->append(imagePart31);
- file31->setParent(imageMultiPart3);
- QHttpPart imagePart32;
- imagePart32.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart32.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage2\""));
- QFile *file32 = new QFile(QFINDTESTDATA("../qnetworkreply/image2.jpg"));
- file32->open(QIODevice::ReadOnly);
- imagePart32.setBodyDevice(file31); // check that resetting works
- imagePart32.setBodyDevice(file32);
- imageMultiPart3->append(imagePart32);
- file32->setParent(imageMultiPart3);
- QHttpPart imagePart33;
- imagePart33.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
- imagePart33.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"testImage3\""));
- QFile *file33 = new QFile(QFINDTESTDATA("../qnetworkreply/image3.jpg"));
- file33->open(QIODevice::ReadOnly);
- imagePart33.setBodyDevice(file33);
- imageMultiPart3->append(imagePart33);
- file33->setParent(imageMultiPart3);
- QByteArray expectedData = "content type: multipart/form-data; boundary=\""
- + imageMultiPart3->boundary();
- expectedData.append("\"\nkey: testImage1, value: 87ef3bb319b004ba9e5e9c9fa713776e\n"
- "key: testImage2, value: 483761b893f7fb1bd2414344cd1f3dfb\n"
- "key: testImage3, value: ab0eb6fd4fcf8b4436254870b4513033\n");
-
- QTest::newRow("multipart-3images") << multiPartUrl << QByteArray() << QByteArray("POST")
- << static_cast<QObject *>(imageMultiPart3) << expectedData
- << QNetworkProxy();
-}
-
-void tst_Spdy::upload()
-{
- QFETCH(QUrl, url);
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- QFETCH(QByteArray, data);
- QFETCH(QByteArray, uploadMethod);
- QFETCH(QObject *, uploadObject);
- QFETCH(QNetworkProxy, proxy);
-
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
-
- QNetworkReply *reply;
- QHttpMultiPart *multiPart = 0;
-
- if (uploadObject) {
- // upload via device
- if (QIODevice *device = qobject_cast<QIODevice *>(uploadObject)) {
- reply = m_manager.post(request, device);
- } else if ((multiPart = qobject_cast<QHttpMultiPart *>(uploadObject))) {
- reply = m_manager.post(request, multiPart);
- } else {
- QFAIL("got unknown upload device");
- }
- } else {
- // upload via byte array
- if (uploadMethod == "PUT") {
- reply = m_manager.put(request, data);
- } else {
- reply = m_manager.post(request, data);
- }
- }
-
- reply->ignoreSslErrors();
- QSignalSpy metaDataChangedSpy(reply, SIGNAL(metaDataChanged()));
- QSignalSpy uploadProgressSpy(reply, SIGNAL(uploadProgress(qint64, qint64)));
- QSignalSpy readyReadSpy(reply, SIGNAL(readyRead()));
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(20);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), 1);
- QCOMPARE(metaDataChangedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QVERIFY(uploadProgressSpy.count() > 0);
- QVERIFY(readyReadSpy.count() > 0);
-
- QCOMPARE(reply->error(), QNetworkReply::NoError);
- QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong();
- if (!multiPart) // script to test multiparts does not return a content length
- QCOMPARE(contentLength, 33); // 33 bytes for md5 sums (including new line)
-
- QFETCH(QByteArray, md5sum);
- QByteArray content = reply->readAll();
- QCOMPARE(content, md5sum);
-
- reply->deleteLater();
- if (uploadObject)
- uploadObject->deleteLater();
-
- m_manager.setProxy(QNetworkProxy()); // reset
-}
-
-void tst_Spdy::errors_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QNetworkProxy>("proxy");
- QTest::addColumn<bool>("ignoreSslErrors");
- QTest::addColumn<int>("expectedReplyError");
-
- QTest::newRow("http-404") << QUrl("https://" + QtNetworkSettings::serverName() + "/non-existent-url")
- << QNetworkProxy() << true << int(QNetworkReply::ContentNotFoundError);
-
- QTest::newRow("ssl-errors") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy() << false << int(QNetworkReply::SslHandshakeFailedError);
-
- QTest::newRow("host-not-found") << QUrl("https://this-host-does-not.exist")
- << QNetworkProxy()
- << true << int(QNetworkReply::HostNotFoundError);
-
- QTest::newRow("proxy-not-found") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy,
- "https://this-host-does-not.exist", 3128)
- << true << int(QNetworkReply::HostNotFoundError);
-
- QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName());
- QString proxyserver = hostInfo.addresses().first().toString();
-
- QTest::newRow("proxy-unavailable") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 10)
- << true << int(QNetworkReply::UnknownNetworkError);
-
- QTest::newRow("no-proxy-credentials") << QUrl("https://" + QtNetworkSettings::serverName())
- << QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3129)
- << true << int(QNetworkReply::ProxyAuthenticationRequiredError);
-}
-
-void tst_Spdy::errors()
-{
- QFETCH(QUrl, url);
- QFETCH(QNetworkProxy, proxy);
- QFETCH(bool, ignoreSslErrors);
- QFETCH(int, expectedReplyError);
-
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
-
- disconnect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- 0, 0);
- if (proxy.type() != QNetworkProxy::DefaultProxy) {
- m_manager.setProxy(proxy);
- }
- QNetworkReply *reply = m_manager.get(request);
- if (ignoreSslErrors)
- reply->ignoreSslErrors();
- QSignalSpy finishedSpy(reply, SIGNAL(finished()));
- QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
-
- QObject::connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedSpy.count(), 1);
- QCOMPARE(errorSpy.count(), 1);
-
- QCOMPARE(reply->error(), static_cast<QNetworkReply::NetworkError>(expectedReplyError));
-
- m_manager.setProxy(QNetworkProxy()); // reset
- m_manager.clearAccessCache(); // e.g. to get an SSL error we need a new connection
- connect(&m_manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
- Qt::UniqueConnection); // reset
-}
-#endif // !QT_NO_NETWORKPROXY
-
-void tst_Spdy::multipleRequests_data()
-{
- QTest::addColumn<QList<QUrl> >("urls");
-
- QString baseUrl = "https://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi?";
- QList<QUrl> urls;
- for (int a = 1; a <= 50; ++a)
- urls.append(QUrl(baseUrl + QLatin1String(QByteArray::number(a))));
-
- QTest::newRow("one-request") << urls.mid(0, 1);
- QTest::newRow("two-requests") << urls.mid(0, 2);
- QTest::newRow("ten-requests") << urls.mid(0, 10);
- QTest::newRow("twenty-requests") << urls.mid(0, 20);
- QTest::newRow("fifty-requests") << urls;
-}
-
-void tst_Spdy::multipleRequestsFinishedSlot()
-{
- m_multipleRepliesFinishedCount++;
- if (m_multipleRepliesFinishedCount == m_multipleRequestsCount)
- QTestEventLoop::instance().exitLoop();
-}
-
-void tst_Spdy::multipleRequests()
-{
- QFETCH(QList<QUrl>, urls);
- m_multipleRequestsCount = urls.count();
- m_multipleRepliesFinishedCount = 0;
-
- QList<QNetworkReply *> replies;
- QList<QSignalSpy *> metaDataChangedSpies;
- QList<QSignalSpy *> readyReadSpies;
- QList<QSignalSpy *> finishedSpies;
-
- foreach (const QUrl &url, urls) {
- QNetworkRequest request(url);
- request.setAttribute(QNetworkRequest::SpdyAllowedAttribute, true);
- QNetworkReply *reply = m_manager.get(request);
- replies.append(reply);
- reply->ignoreSslErrors();
- QObject::connect(reply, SIGNAL(finished()), this, SLOT(multipleRequestsFinishedSlot()));
- QSignalSpy *metaDataChangedSpy = new QSignalSpy(reply, SIGNAL(metaDataChanged()));
- metaDataChangedSpies << metaDataChangedSpy;
- QSignalSpy *readyReadSpy = new QSignalSpy(reply, SIGNAL(readyRead()));
- readyReadSpies << readyReadSpy;
- QSignalSpy *finishedSpy = new QSignalSpy(reply, SIGNAL(finished()));
- finishedSpies << finishedSpy;
- }
-
- QSignalSpy finishedManagerSpy(&m_manager, SIGNAL(finished(QNetworkReply*)));
-
- QTestEventLoop::instance().enterLoop(15);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(finishedManagerSpy.count(), m_multipleRequestsCount);
-
- for (int a = 0; a < replies.count(); ++a) {
-
-#ifndef QT_NO_OPENSSL
- QCOMPARE(replies.at(a)->sslConfiguration().nextProtocolNegotiationStatus(),
- QSslConfiguration::NextProtocolNegotiationNegotiated);
- QCOMPARE(replies.at(a)->sslConfiguration().nextNegotiatedProtocol(),
- QByteArray(QSslConfiguration::NextProtocolSpdy3_0));
-#endif // QT_NO_OPENSSL
-
- QCOMPARE(replies.at(a)->error(), QNetworkReply::NoError);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool(), true);
- QCOMPARE(replies.at(a)->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- // using the echo script, a request to "echo.cgi?1" will return a body of "1"
- QByteArray expectedContent = replies.at(a)->url().query().toUtf8();
- QByteArray content = replies.at(a)->readAll();
- QCOMPARE(expectedContent, content);
-
- QCOMPARE(metaDataChangedSpies.at(a)->count(), 1);
- metaDataChangedSpies.at(a)->deleteLater();
-
- QCOMPARE(finishedSpies.at(a)->count(), 1);
- finishedSpies.at(a)->deleteLater();
-
- QVERIFY(readyReadSpies.at(a)->count() > 0);
- readyReadSpies.at(a)->deleteLater();
-
- replies.at(a)->deleteLater();
- }
-}
-
-QTEST_MAIN(tst_Spdy)
-
-#include "tst_spdy.moc"
diff --git a/tests/auto/network/ssl/qdtls/tst_qdtls.cpp b/tests/auto/network/ssl/qdtls/tst_qdtls.cpp
index 5d79b0f26b..3bbde484ce 100644
--- a/tests/auto/network/ssl/qdtls/tst_qdtls.cpp
+++ b/tests/auto/network/ssl/qdtls/tst_qdtls.cpp
@@ -162,7 +162,6 @@ Q_DECLARE_METATYPE(QSslSocket::SslMode)
Q_DECLARE_METATYPE(QSslSocket::PeerVerifyMode)
Q_DECLARE_METATYPE(QList<QSslCertificate>)
Q_DECLARE_METATYPE(QSslKey)
-Q_DECLARE_METATYPE(QVector<QSslError>)
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/network/ssl/qocsp/tst_qocsp.cpp b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
index 9716c04bbb..4eeea76205 100644
--- a/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
+++ b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
@@ -60,7 +60,6 @@ using VectorOfErrors = QT_PREPEND_NAMESPACE(QVector<SslError>);
using Latin1String = QT_PREPEND_NAMESPACE(QLatin1String);
Q_DECLARE_METATYPE(SslError)
-Q_DECLARE_METATYPE(VectorOfErrors)
Q_DECLARE_METATYPE(Latin1String)
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 5a643c11a2..274fb7b042 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -73,7 +73,7 @@ typedef QSharedPointer<QSslSocket> QSslSocketPtr;
#else
#define FLUKE_CERTIFICATE_ERROR QSslError::CertificateUntrusted
#endif
-#endif // QT_NO_SSL
+#endif // QT_NO_OPENSSL
// Detect ALPN (Application-Layer Protocol Negotiation) support
#undef ALPN_SUPPORTED // Undef the variable first to be safe
@@ -259,10 +259,14 @@ private slots:
void signatureAlgorithm();
#endif
- void disabledProtocols_data();
- void disabledProtocols();
+ void unsupportedProtocols_data();
+ void unsupportedProtocols();
void oldErrorsOnSocketReuse();
+#if QT_CONFIG(openssl)
+ void alertMissingCertificate();
+ void alertInvalidCertificate();
+#endif // openssl
void setEmptyDefaultConfiguration(); // this test should be last
@@ -337,6 +341,8 @@ tst_QSslSocket::tst_QSslSocket()
qRegisterMetaType<QSslError>("QSslError");
qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
+ qRegisterMetaType<QAlertLevel>("QAlertLevel");
+ qRegisterMetaType<QAlertType>("QAlertType");
#ifndef QT_NO_OPENSSL
qRegisterMetaType<QSslPreSharedKeyAuthenticator *>();
@@ -1179,25 +1185,6 @@ void tst_QSslSocket::protocol()
QCOMPARE(socket->protocol(), QSsl::AnyProtocol);
socket->abort();
}
- {
- // qt-test-server allows TlsV1, so it allows TlsV1SslV3
- socket->setProtocol(QSsl::TlsV1SslV3);
- QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3);
- socket->connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443);
- if (setProxy && !socket->waitForEncrypted())
- QSKIP("Skipping flaky test - See QTBUG-29941");
- QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3);
- socket->abort();
- QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3);
- socket->connectToHost(QtNetworkSettings::httpServerName(), 443);
- if (setProxy && !socket->waitForConnected())
- QSKIP("Skipping flaky test - See QTBUG-29941");
- socket->startClientEncryption();
- if (setProxy && !socket->waitForEncrypted())
- QSKIP("Skipping flaky test - See QTBUG-29941");
- QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3);
- socket->abort();
- }
}
class SslServer : public QTcpServer
@@ -1229,6 +1216,8 @@ public:
signals:
void socketError(QAbstractSocket::SocketError);
+ void gotAlert(QAlertLevel level, QAlertType type, const QString &message);
+ void alertSent(QAlertLevel level, QAlertType type, const QString &message);
protected:
void incomingConnection(qintptr socketDescriptor)
@@ -1240,6 +1229,8 @@ protected:
if (ignoreSslErrors)
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
+ connect(socket, &QSslSocket::alertReceived, this, &SslServer::gotAlert);
+ connect(socket, &QSslSocket::alertSent, this, &SslServer::alertSent);
QFile file(m_keyFile);
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -1303,20 +1294,13 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::addColumn<bool>("works");
QTest::newRow("tls1.0-tls1.0") << QSsl::TlsV1_0 << QSsl::TlsV1_0 << true;
- QTest::newRow("tls1ssl3-tls1ssl3") << QSsl::TlsV1SslV3 << QSsl::TlsV1SslV3 << true;
QTest::newRow("any-any") << QSsl::AnyProtocol << QSsl::AnyProtocol << true;
QTest::newRow("secure-secure") << QSsl::SecureProtocols << QSsl::SecureProtocols << true;
- QTest::newRow("tls1-tls1ssl3") << QSsl::TlsV1_0 << QSsl::TlsV1SslV3 << true;
QTest::newRow("tls1.0-secure") << QSsl::TlsV1_0 << QSsl::SecureProtocols << true;
QTest::newRow("tls1.0-any") << QSsl::TlsV1_0 << QSsl::AnyProtocol << true;
- QTest::newRow("tls1ssl3-tls1.0") << QSsl::TlsV1SslV3 << QSsl::TlsV1_0 << true;
- QTest::newRow("tls1ssl3-secure") << QSsl::TlsV1SslV3 << QSsl::SecureProtocols << true;
- QTest::newRow("tls1ssl3-any") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true;
-
QTest::newRow("secure-tls1.0") << QSsl::SecureProtocols << QSsl::TlsV1_0 << true;
- QTest::newRow("secure-tls1ssl3") << QSsl::SecureProtocols << QSsl::TlsV1SslV3 << true;
QTest::newRow("secure-any") << QSsl::SecureProtocols << QSsl::AnyProtocol << true;
QTest::newRow("tls1.0orlater-tls1.0") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_0 << true;
@@ -1348,7 +1332,6 @@ void tst_QSslSocket::protocolServerSide_data()
#endif // TLS1_3_VERSION
QTest::newRow("any-tls1.0") << QSsl::AnyProtocol << QSsl::TlsV1_0 << true;
- QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true;
QTest::newRow("any-secure") << QSsl::AnyProtocol << QSsl::SecureProtocols << true;
}
@@ -4325,27 +4308,30 @@ void tst_QSslSocket::forwardReadChannelFinished()
#endif // QT_NO_OPENSSL
-void tst_QSslSocket::disabledProtocols_data()
+void tst_QSslSocket::unsupportedProtocols_data()
{
- QTest::addColumn<QSsl::SslProtocol>("disabledProtocol");
- QTest::newRow("SslV2") << QSsl::SslV2;
- QTest::newRow("SslV3") << QSsl::SslV3;
+ QTest::addColumn<QSsl::SslProtocol>("unsupportedProtocol");
+ QTest::newRow("DtlsV1_0") << QSsl::DtlsV1_0;
+ QTest::newRow("DtlsV1_2") << QSsl::DtlsV1_2;
+ QTest::newRow("DtlsV1_0OrLater") << QSsl::DtlsV1_0OrLater;
+ QTest::newRow("DtlsV1_2OrLater") << QSsl::DtlsV1_2OrLater;
+ QTest::newRow("UnknownProtocol") << QSsl::UnknownProtocol;
}
-void tst_QSslSocket::disabledProtocols()
+void tst_QSslSocket::unsupportedProtocols()
{
QFETCH_GLOBAL(const bool, setProxy);
if (setProxy)
return;
- QFETCH(const QSsl::SslProtocol, disabledProtocol);
+ QFETCH(const QSsl::SslProtocol, unsupportedProtocol);
const int timeoutMS = 500;
// Test a client socket.
{
// 0. connectToHostEncrypted: client-side, non-blocking API, error is discovered
// early, preventing any real connection from ever starting.
QSslSocket socket;
- socket.setProtocol(disabledProtocol);
+ socket.setProtocol(unsupportedProtocol);
QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
socket.connectToHostEncrypted(QStringLiteral("doesnotmatter.org"), 1010);
QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
@@ -4363,7 +4349,7 @@ void tst_QSslSocket::disabledProtocols()
socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
QVERIFY(socket.waitForConnected(timeoutMS));
- socket.setProtocol(disabledProtocol);
+ socket.setProtocol(unsupportedProtocol);
socket.startClientEncryption();
QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
}
@@ -4377,7 +4363,7 @@ void tst_QSslSocket::disabledProtocols()
// and then calls startServerEncryption() (which must fall).
{
SslServer server;
- server.protocol = disabledProtocol;
+ server.protocol = unsupportedProtocol;
QVERIFY(server.listen());
QTestEventLoop loop;
@@ -4442,6 +4428,119 @@ void tst_QSslSocket::oldErrorsOnSocketReuse()
#endif // QT_NO_SSL
+#if QT_CONFIG(openssl)
+
+void (QSslSocket::*const tlsErrorSignal)(const QList<QSslError> &) = &QSslSocket::sslErrors;
+void (QAbstractSocket::*const socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::error;
+
+void tst_QSslSocket::alertMissingCertificate()
+{
+ // In this test we want a server to abort the connection due to the failing
+ // client authentication. The server expected to send an alert before closing
+ // the connection, and the client expected to receive this alert and report it.
+
+ QFETCH_GLOBAL(const bool, setProxy);
+ if (setProxy) // Not what we test here, bail out.
+ return;
+
+ SslServer server;
+ if (!server.listen(QHostAddress::LocalHost))
+ QSKIP("SslServer::listen() returned false");
+
+ // We want a certificate request to be sent to the client:
+ server.peerVerifyMode = QSslSocket::VerifyPeer;
+ // The only way we can force OpenSSL to send an alert - is to use
+ // a special option (so we fail before handshake is finished):
+ server.config.setMissingCertificateIsFatal(true);
+
+ QSslSocket clientSocket;
+ connect(&clientSocket, tlsErrorSignal, [&clientSocket](const QList<QSslError> &errors){
+ qDebug() << "ERR";
+ clientSocket.ignoreSslErrors(errors);
+ });
+
+ QSignalSpy serverSpy(&server, &SslServer::alertSent);
+ QSignalSpy clientSpy(&clientSocket, &QSslSocket::alertReceived);
+
+ clientSocket.connectToHostEncrypted(server.serverAddress().toString(), server.serverPort());
+
+ QTestEventLoop runner;
+ QTimer::singleShot(500, [&runner](){
+ runner.exitLoop();
+ });
+
+ int waitFor = 2;
+ auto earlyQuitter = [&runner, &waitFor](QAbstractSocket::SocketError) {
+ if (!--waitFor)
+ runner.exitLoop();
+ };
+
+ // Presumably, RemoteHostClosedError for the client and SslHandshakeError
+ // for the server:
+ connect(&clientSocket, socketErrorSignal, earlyQuitter);
+ connect(&server, &SslServer::socketError, earlyQuitter);
+
+ runner.enterLoopMSecs(1000);
+
+ QVERIFY(serverSpy.count() > 0);
+ QVERIFY(clientSpy.count() > 0);
+ QVERIFY(server.socket && !server.socket->isEncrypted());
+ QVERIFY(!clientSocket.isEncrypted());
+}
+
+void tst_QSslSocket::alertInvalidCertificate()
+{
+ // In this test a client will not ignore verification errors,
+ // it also will do 'early' checks, meaning the reported and
+ // not ignored _during_ the hanshake, not after. This ensures
+ // OpenSSL sends an alert.
+ QFETCH_GLOBAL(const bool, setProxy);
+ if (setProxy) // Not what we test here, bail out.
+ return;
+
+ SslServer server;
+ if (!server.listen(QHostAddress::LocalHost))
+ QSKIP("SslServer::listen() returned false");
+
+ QSslSocket clientSocket;
+ auto configuration = QSslConfiguration::defaultConfiguration();
+ configuration.setHandshakeMustInterruptOnError(true);
+ QVERIFY(configuration.handshakeMustInterruptOnError());
+ clientSocket.setSslConfiguration(configuration);
+
+ QSignalSpy serverSpy(&server, &SslServer::gotAlert);
+ QSignalSpy clientSpy(&clientSocket, &QSslSocket::alertSent);
+ QSignalSpy interruptedSpy(&clientSocket, &QSslSocket::handshakeInterruptedOnError);
+
+ clientSocket.connectToHostEncrypted(server.serverAddress().toString(), server.serverPort());
+
+ QTestEventLoop runner;
+ QTimer::singleShot(500, [&runner](){
+ runner.exitLoop();
+ });
+
+ int waitFor = 2;
+ auto earlyQuitter = [&runner, &waitFor](QAbstractSocket::SocketError) {
+ if (!--waitFor)
+ runner.exitLoop();
+ };
+
+ // Presumably, RemoteHostClosedError for the server and SslHandshakeError
+ // for the client:
+ connect(&clientSocket, socketErrorSignal, earlyQuitter);
+ connect(&server, &SslServer::socketError, earlyQuitter);
+
+ runner.enterLoopMSecs(1000);
+
+ QVERIFY(serverSpy.count() > 0);
+ QVERIFY(clientSpy.count() > 0);
+ QVERIFY(interruptedSpy.count() > 0);
+ QVERIFY(server.socket && !server.socket->isEncrypted());
+ QVERIFY(!clientSocket.isEncrypted());
+}
+
+#endif // openssl
+
QTEST_MAIN(tst_QSslSocket)
#include "tst_qsslsocket.moc"
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index de15f4c62d..78026665be 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -634,7 +634,7 @@ void tst_Compiler::cxx11_alignas()
struct S {
alignas(double) char c;
};
- QCOMPARE(Q_ALIGNOF(S), Q_ALIGNOF(double));
+ QCOMPARE(alignof(S), alignof(double));
#endif
}
@@ -1396,7 +1396,7 @@ void tst_Compiler::cxx11_unrestricted_unions()
~U() {}
};
U u;
- std::aligned_storage<sizeof(QString), Q_ALIGNOF(QString)> as;
+ std::aligned_storage<sizeof(QString), alignof(QString)> as;
Q_UNUSED(u);
Q_UNUSED(as);
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 95a8230fe3..d2a9688f10 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -203,11 +203,15 @@ private slots:
void applicationTest();
void mainWindowTest();
void subWindowTest();
+#if QT_CONFIG(shortcut)
void buttonTest();
+#endif
void scrollBarTest();
void tabTest();
void tabWidgetTest();
+#if QT_CONFIG(shortcut)
void menuTest();
+#endif
void spinBoxTest();
void doubleSpinBoxTest();
void textEditTest();
@@ -234,8 +238,10 @@ private slots:
void dockWidgetTest();
void comboBoxTest();
void accessibleName();
+#if QT_CONFIG(shortcut)
void labelTest();
void accelerators();
+#endif
void bridgeTest();
protected slots:
@@ -1026,6 +1032,8 @@ public Q_SLOTS:
}
};
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::buttonTest()
{
QWidget window;
@@ -1198,6 +1206,8 @@ void tst_QAccessibility::buttonTest()
// test->release();
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAccessibility::scrollBarTest()
{
QScrollBar *scrollBar = new QScrollBar(Qt::Horizontal);
@@ -1407,6 +1417,8 @@ void tst_QAccessibility::tabWidgetTest()
QTestAccessibility::clearEvents();
}
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::menuTest()
{
{
@@ -1617,6 +1629,8 @@ void tst_QAccessibility::menuTest()
QTestAccessibility::clearEvents();
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAccessibility::spinBoxTest()
{
QSpinBox * const spinBox = new QSpinBox();
@@ -3629,6 +3643,8 @@ void tst_QAccessibility::comboBoxTest()
QTestAccessibility::clearEvents();
}
+#if QT_CONFIG(shortcut)
+
void tst_QAccessibility::labelTest()
{
QWidget *window = new QWidget;
@@ -3729,6 +3745,8 @@ void tst_QAccessibility::accelerators()
QTestAccessibility::clearEvents();
}
+#endif // QT_CONFIG(shortcut)
+
#ifdef QT_SUPPORTS_IACCESSIBLE2
static IUnknown *queryIA2(IAccessible *acc, const IID &iid)
{
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 260ba12a97..9285d5b5da 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -91,7 +91,9 @@ private slots:
void checkReason_BackTab();
void checkReason_Popup();
void checkReason_focusWidget();
+#if QT_CONFIG(shortcut)
void checkReason_Shortcut();
+#endif
void checkReason_ActiveWindow();
private:
@@ -250,6 +252,8 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
#endif
+#if QT_CONFIG(shortcut)
+
void tst_QFocusEvent::checkReason_Shortcut()
{
initWidget();
@@ -288,6 +292,8 @@ void tst_QFocusEvent::checkReason_Shortcut()
#endif
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QFocusEvent::checkReason_focusWidget()
{
// This test checks that a widget doesn't loose
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index ab7bca8322..9591eca16a 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -97,14 +97,14 @@ void tst_toolsupport::offsets_data()
{
QTestData &data = QTest::newRow("sizeof(QObjectData)")
<< sizeof(QObjectData);
- data << 28 << 48; // vptr + 3 ptr + 2 int + ptr
+ data << 36 << 64; // vptr + 2 ptr + (2*ptr + int) + 2 int + ptr
}
#if RUN_MEMBER_OFFSET_TEST
{
QTestData &data = QTest::newRow("QObjectPrivate::extraData")
<< pmm_to_offsetof(&QObjectPrivate::extraData);
- data << 28 << 48; // sizeof(QObjectData)
+ data << 36 << 64; // sizeof(QObjectData)
}
{
@@ -126,9 +126,9 @@ void tst_toolsupport::offsets_data()
#ifdef Q_PROCESSOR_X86
// x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in
// qglobal.h for more details.
- data << 152 << 224;
+ data << 184 << 288;
#else
- data << 156 << 224;
+ data << 188 << 288;
#endif
}
#endif
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index 1a5aa63489..4c3749eaee 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -1846,7 +1846,8 @@ void tst_QSqlQuery::precision()
QSKIP("DB unable to store high precision");
const QString qtest_precision(qTableName("qtest_precision", __FILE__, db));
- static const char* precStr = "1.2345678901234567891";
+ static const char precStr[] = "1.2345678901234567891";
+ const int precStrLen = sizeof(precStr);
{
// need a new scope for SQLITE
@@ -1868,7 +1869,7 @@ void tst_QSqlQuery::precision()
if ( !val.startsWith( "1.2345678901234567891" ) ) {
int i = 0;
- while ( precStr[i] != 0 && *( precStr + i ) == val[i].toLatin1() )
+ while ( i < precStrLen && i < val.size() && precStr[i] != 0 && *( precStr + i ) == val[i].toLatin1() )
i++;
// MySQL and TDS have crappy precisions by default
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.lightxml b/tests/auto/testlib/selftests/expected_signaldumper.lightxml
index 443f649bb6..8ce57e4b84 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.lightxml
+++ b/tests/auto/testlib/selftests/expected_signaldumper.lightxml
@@ -542,7 +542,7 @@
<Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]></Description>
</Message>
<Message type="info" file="" line="0">
- <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]></Description>
+ <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())]]></Description>
</Message>
<Message type="info" file="" line="0">
<Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]></Description>
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.tap b/tests/auto/testlib/selftests/expected_signaldumper.tap
index e2d664f4f1..39419280d4 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.tap
+++ b/tests/auto/testlib/selftests/expected_signaldumper.tap
@@ -134,7 +134,7 @@ ok 18 - slotEmittingSignalOldSyntax(queued)
# Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)
# Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))
# Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))
-# Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())
+# Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())
# Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())
# Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)
# Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.teamcity b/tests/auto/testlib/selftests/expected_signaldumper.teamcity
index 0fc568e086..15bb4ddfe1 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.teamcity
+++ b/tests/auto/testlib/selftests/expected_signaldumper.teamcity
@@ -54,7 +54,7 @@
##teamcity[testStdOut name='slotEmittingSignalOldSyntax(queued)' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()|nINFO: Signal: QEventDispatcherPlatform(_POINTER_) awake ()|nINFO: Signal: SignalSlotClass(_POINTER_) nestedSignal ()' flowId='tst_Signaldumper']
##teamcity[testFinished name='slotEmittingSignalOldSyntax(queued)' flowId='tst_Signaldumper']
##teamcity[testStarted name='variousTypes()' flowId='tst_Signaldumper']
-##teamcity[testStdOut name='variousTypes()' out='INFO: Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))|nINFO: Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())' flowId='tst_Signaldumper']
+##teamcity[testStdOut name='variousTypes()' out='INFO: Signal: SignalSlotClass(_POINTER_) qStringSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))|nINFO: Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))|nINFO: Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorConstPointerSignal ((const QVector<int>*)_POINTER_)|nINFO: Signal: SignalSlotClass(_POINTER_) qVectorPointerConstSignal ()|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())|nINFO: Signal: SignalSlotClass(_POINTER_) qVariantSignal (QVariant())' flowId='tst_Signaldumper']
##teamcity[testFinished name='variousTypes()' flowId='tst_Signaldumper']
##teamcity[testStarted name='deletingSender()' flowId='tst_Signaldumper']
##teamcity[testStdOut name='deletingSender()' out='INFO: Signal: SignalSlotClass(_POINTER_) signalWithoutParameters ()' flowId='tst_Signaldumper']
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.txt b/tests/auto/testlib/selftests/expected_signaldumper.txt
index 0ee8cd38a2..92d609d14c 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.txt
+++ b/tests/auto/testlib/selftests/expected_signaldumper.txt
@@ -134,7 +134,7 @@ INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qSt
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))
-INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())
+INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)
INFO : tst_Signaldumper::variousTypes() Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.xml b/tests/auto/testlib/selftests/expected_signaldumper.xml
index f11a0c3ce6..01b0471268 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.xml
+++ b/tests/auto/testlib/selftests/expected_signaldumper.xml
@@ -544,7 +544,7 @@
<Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]></Description>
</Message>
<Message type="info" file="" line="0">
- <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]></Description>
+ <Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())]]></Description>
</Message>
<Message type="info" file="" line="0">
<Description><![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]></Description>
diff --git a/tests/auto/testlib/selftests/expected_signaldumper.xunitxml b/tests/auto/testlib/selftests/expected_signaldumper.xunitxml
index cbf7075ba1..6609f518a2 100644
--- a/tests/auto/testlib/selftests/expected_signaldumper.xunitxml
+++ b/tests/auto/testlib/selftests/expected_signaldumper.xunitxml
@@ -142,7 +142,7 @@
<!-- message="Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&amp;)@_POINTER_)" type="info" -->
<!-- message="Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))" type="info" -->
<!-- message="Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))" type="info" -->
- <!-- message="Signal: SignalSlotClass(_POINTER_) qListSignal (QList&lt;int&gt;())" type="info" -->
+ <!-- message="Signal: SignalSlotClass(_POINTER_) qListSignal (QVector&lt;int&gt;())" type="info" -->
<!-- message="Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector&lt;int&gt;())" type="info" -->
<!-- message="Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector&lt;int&gt;&amp;)@_POINTER_)" type="info" -->
<!-- message="Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector&lt;int&gt;())" type="info" -->
@@ -274,7 +274,7 @@
<![CDATA[Signal: SignalSlotClass(_POINTER_) qStringRefSignal ((QString&)@_POINTER_)]]>
<![CDATA[Signal: SignalSlotClass(_POINTER_) qStringConstRefSignal (QString(Test string))]]>
<![CDATA[Signal: SignalSlotClass(_POINTER_) qByteArraySignal (QByteArray(Test bytearray))]]>
-<![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QList<int>())]]>
+<![CDATA[Signal: SignalSlotClass(_POINTER_) qListSignal (QVector<int>())]]>
<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorSignal (QVector<int>())]]>
<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorRefSignal ((QVector<int>&)@_POINTER_)]]>
<![CDATA[Signal: SignalSlotClass(_POINTER_) qVectorConstRefSignal (QVector<int>())]]>
diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json
index bde5a1c52b..9f99de65b5 100644
--- a/tests/auto/tools/moc/allmocs_baseline_in.json
+++ b/tests/auto/tools/moc/allmocs_baseline_in.json
@@ -2,68 +2,6 @@
{
"classes": [
{
- "className": "MyBooooooostishClass",
- "qualifiedClassName": "MyBooooooostishClass",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- }
- ],
- "slots": [
- {
- "access": "public",
- "name": "mySlot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "no-keywords.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "Task87883",
- "qualifiedClassName": "Task87883",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "task87883.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "IfdefedClass",
- "qualifiedClassName": "IfdefedClass",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "c-comments.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
"className": "BackslashNewlines",
"qualifiedClassName": "BackslashNewlines",
"slots": [
@@ -87,340 +25,8 @@
{
"classes": [
{
- "className": "OldStyleCast",
- "qualifiedClassName": "OldStyleCast",
- "slots": [
- {
- "access": "public",
- "name": "foo",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "int"
- },
- {
- "type": "int*"
- },
- {
- "type": "const int*"
- },
- {
- "type": "volatile int*"
- },
- {
- "type": "const int*volatile*"
- }
- ],
- "name": "bar",
- "returnType": "int"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "int"
- },
- {
- "type": "QObject*const"
- }
- ],
- "name": "slot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "oldstyle-casts.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "SlotsWithVoidTemplateTest",
- "qualifiedClassName": "SlotsWithVoidTemplateTest",
- "signals": [
- {
- "access": "public",
- "arguments": [
- {
- "type": "TestTemplate<void>"
- }
- ],
- "name": "mySignal",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "myVoidSignal",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "myVoidSignal2",
- "returnType": "void"
- }
- ],
- "slots": [
- {
- "access": "public",
- "name": "dummySlot",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "dummySlot2",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "TestTemplate<void>"
- }
- ],
- "name": "anotherSlot",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "mySlot",
- "returnType": "TestTemplate<void>"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "slots-with-void-template.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "InvokableBeforeReturnType",
- "methods": [
- {
- "access": "public",
- "name": "foo",
- "returnType": "const char*"
- }
- ],
- "qualifiedClassName": "InvokableBeforeReturnType",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "InvokableBeforeInline",
- "methods": [
- {
- "access": "public",
- "name": "foo",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "bar",
- "returnType": "void"
- }
- ],
- "qualifiedClassName": "InvokableBeforeInline",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "qinvokable.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "Bar",
- "enums": [
- {
- "alias": "Flag",
- "isClass": false,
- "isFlag": true,
- "name": "Flags",
- "values": [
- "Read",
- "Write"
- ]
- }
- ],
- "properties": [
- {
- "constant": false,
- "designable": true,
- "final": false,
- "name": "flags",
- "read": "flags",
- "scriptable": true,
- "stored": true,
- "type": "Flags",
- "user": false,
- "write": "setFlags"
- }
- ],
- "qualifiedClassName": "Foo::Bar",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "Baz",
- "properties": [
- {
- "constant": false,
- "designable": true,
- "final": false,
- "name": "flags",
- "read": "flags",
- "scriptable": true,
- "stored": true,
- "type": "Foo::Bar::Flags",
- "user": false,
- "write": "setFlags"
- },
- {
- "constant": false,
- "designable": true,
- "final": false,
- "name": "flagsList",
- "read": "flagsList",
- "scriptable": true,
- "stored": true,
- "type": "QList<Foo::Bar::Flags>",
- "user": false,
- "write": "setFlagsList"
- }
- ],
- "qualifiedClassName": "Foo::Baz",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "namespaced-flags.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "Foo",
- "qualifiedClassName": "BBB::Foo",
- "signals": [
- {
- "access": "public",
- "arguments": [
- {
- "type": "QList<QList<int> >"
- }
- ],
- "name": "foo",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "QList<QList<int> >"
- }
- ],
- "name": "foo2",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "QList< ::AAA::BaseA*>"
- }
- ],
- "name": "bar",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "QList< ::AAA::BaseA*>"
- }
- ],
- "name": "bar2",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "QList<const ::AAA::BaseA*>"
- }
- ],
- "name": "bar3",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- },
- {
- "access": "public",
- "name": "::AAA::BaseA"
- }
- ]
- }
- ],
- "inputFile": "trigraphs.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "classInfos": [
- {
- "name": "Test",
- "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\x53"
- },
- {
- "name": "Test2",
- "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\123"
- },
- {
- "name": "Test3",
- "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\nb"
- }
- ],
- "className": "StringLiterals",
- "qualifiedClassName": "StringLiterals",
+ "className": "IfdefedClass",
+ "qualifiedClassName": "IfdefedClass",
"superClasses": [
{
"access": "public",
@@ -429,7 +35,7 @@
]
}
],
- "inputFile": "escapes-in-string-literals.h",
+ "inputFile": "c-comments.h",
"outputRevision": 67
},
{
@@ -466,475 +72,6 @@
{
"classes": [
{
- "className": "TestQPrivateSlots",
- "methods": [
- {
- "access": "private",
- "name": "method1",
- "returnType": "void"
- }
- ],
- "qualifiedClassName": "TestQPrivateSlots",
- "slots": [
- {
- "access": "private",
- "name": "_q_privateslot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "qprivateslots.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "GadgetWithNoEnums",
- "gadget": true,
- "qualifiedClassName": "GadgetWithNoEnums"
- },
- {
- "className": "DerivedGadgetWithEnums",
- "enums": [
- {
- "isClass": false,
- "isFlag": false,
- "name": "FooEnum",
- "values": [
- "FooValue"
- ]
- }
- ],
- "gadget": true,
- "qualifiedClassName": "DerivedGadgetWithEnums",
- "superClasses": [
- {
- "access": "public",
- "name": "GadgetWithNoEnums"
- }
- ]
- }
- ],
- "inputFile": "gadgetwithnoenums.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "DirInIncludePath",
- "interfaces": [
- [
- {
- "className": "MyInterface",
- "id": "\"MyInterface\""
- }
- ]
- ],
- "qualifiedClassName": "DirInIncludePath",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- },
- {
- "access": "public",
- "name": "MyInterface"
- }
- ]
- }
- ],
- "inputFile": "dir-in-include-path.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "SingleFunctionKeywordBeforeReturnType",
- "qualifiedClassName": "SingleFunctionKeywordBeforeReturnType",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- }
- ],
- "slots": [
- {
- "access": "public",
- "name": "mySlot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "SingleFunctionKeywordBeforeInline",
- "qualifiedClassName": "SingleFunctionKeywordBeforeInline",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- }
- ],
- "slots": [
- {
- "access": "public",
- "name": "mySlot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "SingleFunctionKeywordAfterInline",
- "qualifiedClassName": "SingleFunctionKeywordAfterInline",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- }
- ],
- "slots": [
- {
- "access": "public",
- "name": "mySlot",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "single_function_keyword.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "Task192552",
- "qualifiedClassName": "Task192552",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "task192552.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "InlineSlotsWithThrowDeclaration",
- "qualifiedClassName": "InlineSlotsWithThrowDeclaration",
- "slots": [
- {
- "access": "public",
- "name": "a",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "b",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "c",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "d",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "e",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "task189996.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "TestObject",
- "qualifiedClassName": "NS_A::NS_B::TestObject",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "TestMain",
- "qualifiedClassName": "NS_A::NS_Main::TestMain",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "task234909.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "TypenameWithUnsigned",
- "qualifiedClassName": "TypenameWithUnsigned",
- "slots": [
- {
- "access": "public",
- "arguments": [
- {
- "type": "uint"
- }
- ],
- "name": "a",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "u",
- "type": "uint"
- }
- ],
- "name": "b",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "uint*"
- }
- ],
- "name": "c",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "p",
- "type": "uint*"
- }
- ],
- "name": "d",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "uint&"
- }
- ],
- "name": "e",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "r",
- "type": "uint&"
- }
- ],
- "name": "f",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "unsigned1"
- }
- ],
- "name": "g",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "u1",
- "type": "unsigned1"
- }
- ],
- "name": "h",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "uint"
- },
- {
- "type": "unsigned1"
- }
- ],
- "name": "i",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "unsigned1"
- },
- {
- "type": "uint"
- }
- ],
- "name": "j",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "type": "unsignedQImage"
- }
- ],
- "name": "k",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "uqi",
- "type": "unsignedQImage"
- }
- ],
- "name": "l",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "task240368.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "PureVirtualSignalsTest",
- "qualifiedClassName": "PureVirtualSignalsTest",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- },
- {
- "access": "public",
- "name": "myOtherSignal",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "foo",
- "type": "int"
- }
- ],
- "name": "mySignal2",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "PureVirtualSignalsImpl",
- "qualifiedClassName": "PureVirtualSignalsImpl",
- "signals": [
- {
- "access": "public",
- "name": "mySignal",
- "returnType": "void"
- },
- {
- "access": "public",
- "arguments": [
- {
- "name": "foo",
- "type": "int"
- }
- ],
- "name": "mySignal2",
- "returnType": "void"
- }
- ],
- "superClasses": [
- {
- "access": "public",
- "name": "PureVirtualSignalsTest"
- }
- ]
- }
- ],
- "inputFile": "pure-virtual-signals.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
"className": "CXX11Enums",
"enums": [
{
@@ -1101,102 +238,6 @@
{
"classes": [
{
- "className": "FinalTestClassQt",
- "qualifiedClassName": "FinalTestClassQt",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedFinalTestClassQt",
- "qualifiedClassName": "ExportedFinalTestClassQt",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedFinalTestClassQtX",
- "qualifiedClassName": "ExportedFinalTestClassQtX",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "FinalTestClassCpp11",
- "qualifiedClassName": "FinalTestClassCpp11",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedFinalTestClassCpp11",
- "qualifiedClassName": "ExportedFinalTestClassCpp11",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedFinalTestClassCpp11X",
- "qualifiedClassName": "ExportedFinalTestClassCpp11X",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "SealedTestClass",
- "qualifiedClassName": "SealedTestClass",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedSealedTestClass",
- "qualifiedClassName": "ExportedSealedTestClass",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
- {
- "className": "ExportedSealedTestClassX",
- "qualifiedClassName": "ExportedSealedTestClassX",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- }
- ],
- "inputFile": "cxx11-final-classes.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
"className": "ExplicitOverrideControlBase",
"qualifiedClassName": "ExplicitOverrideControlBase",
"slots": [
@@ -1491,6 +532,196 @@
{
"classes": [
{
+ "className": "FinalTestClassQt",
+ "qualifiedClassName": "FinalTestClassQt",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedFinalTestClassQt",
+ "qualifiedClassName": "ExportedFinalTestClassQt",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedFinalTestClassQtX",
+ "qualifiedClassName": "ExportedFinalTestClassQtX",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "FinalTestClassCpp11",
+ "qualifiedClassName": "FinalTestClassCpp11",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedFinalTestClassCpp11",
+ "qualifiedClassName": "ExportedFinalTestClassCpp11",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedFinalTestClassCpp11X",
+ "qualifiedClassName": "ExportedFinalTestClassCpp11X",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "SealedTestClass",
+ "qualifiedClassName": "SealedTestClass",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedSealedTestClass",
+ "qualifiedClassName": "ExportedSealedTestClass",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "ExportedSealedTestClassX",
+ "qualifiedClassName": "ExportedSealedTestClassX",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "cxx11-final-classes.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "ClassInNamespace",
+ "enums": [
+ {
+ "isClass": false,
+ "isFlag": false,
+ "name": "GadEn",
+ "values": [
+ "Value"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "CXX17Namespace::A::B::C::D::ClassInNamespace"
+ },
+ {
+ "className": "D",
+ "enums": [
+ {
+ "isClass": false,
+ "isFlag": false,
+ "name": "NamEn",
+ "values": [
+ "Value"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "CXX17Namespace::A::B::C::D"
+ }
+ ],
+ "inputFile": "cxx17-namespaces.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "DirInIncludePath",
+ "interfaces": [
+ [
+ {
+ "className": "MyInterface",
+ "id": "\"MyInterface\""
+ }
+ ]
+ ],
+ "qualifiedClassName": "DirInIncludePath",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ },
+ {
+ "access": "public",
+ "name": "MyInterface"
+ }
+ ]
+ }
+ ],
+ "inputFile": "dir-in-include-path.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "classInfos": [
+ {
+ "name": "Test",
+ "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\x53"
+ },
+ {
+ "name": "Test2",
+ "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\123"
+ },
+ {
+ "name": "Test3",
+ "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\nb"
+ }
+ ],
+ "className": "StringLiterals",
+ "qualifiedClassName": "StringLiterals",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "escapes-in-string-literals.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
"className": "ForwardDeclaredParamClass",
"qualifiedClassName": "ForwardDeclaredParamClass",
"signals": [
@@ -1691,6 +922,334 @@
{
"classes": [
{
+ "className": "FunctionWithAttributes",
+ "qualifiedClassName": "FunctionWithAttributes",
+ "slots": [
+ {
+ "access": "public",
+ "name": "test1",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "test2",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "function-with-attributes.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "GadgetWithNoEnums",
+ "gadget": true,
+ "qualifiedClassName": "GadgetWithNoEnums"
+ },
+ {
+ "className": "DerivedGadgetWithEnums",
+ "enums": [
+ {
+ "isClass": false,
+ "isFlag": false,
+ "name": "FooEnum",
+ "values": [
+ "FooValue"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "DerivedGadgetWithEnums",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "GadgetWithNoEnums"
+ }
+ ]
+ }
+ ],
+ "inputFile": "gadgetwithnoenums.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "BaseGadget",
+ "gadget": true,
+ "qualifiedClassName": "GrandParentGadget::BaseGadget"
+ },
+ {
+ "className": "DerivedGadget",
+ "gadget": true,
+ "qualifiedClassName": "GrandParentGadget::DerivedGadget",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "Derived"
+ }
+ ]
+ }
+ ],
+ "inputFile": "grand-parent-gadget-class.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "FooNamespace",
+ "enums": [
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "Enum1",
+ "values": [
+ "Key1",
+ "Key2"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "FooNamespace"
+ },
+ {
+ "className": "FooNestedNamespace",
+ "enums": [
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "Enum2",
+ "values": [
+ "Key3",
+ "Key4"
+ ]
+ },
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "Enum3",
+ "values": [
+ "Key5",
+ "Key6"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "FooNamespace::FooNestedNamespace"
+ },
+ {
+ "className": "FooMoreNestedNamespace",
+ "enums": [
+ {
+ "isClass": true,
+ "isFlag": false,
+ "name": "Enum4",
+ "values": [
+ "Key7",
+ "Key8"
+ ]
+ }
+ ],
+ "gadget": true,
+ "qualifiedClassName": "FooNamespace::FooNestedNamespace::FooMoreNestedNamespace"
+ }
+ ],
+ "inputFile": "namespace.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "Bar",
+ "enums": [
+ {
+ "alias": "Flag",
+ "isClass": false,
+ "isFlag": true,
+ "name": "Flags",
+ "values": [
+ "Read",
+ "Write"
+ ]
+ }
+ ],
+ "properties": [
+ {
+ "constant": false,
+ "designable": true,
+ "final": false,
+ "name": "flags",
+ "read": "flags",
+ "scriptable": true,
+ "stored": true,
+ "type": "Flags",
+ "user": false,
+ "write": "setFlags"
+ }
+ ],
+ "qualifiedClassName": "Foo::Bar",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "Baz",
+ "properties": [
+ {
+ "constant": false,
+ "designable": true,
+ "final": false,
+ "name": "flags",
+ "read": "flags",
+ "scriptable": true,
+ "stored": true,
+ "type": "Foo::Bar::Flags",
+ "user": false,
+ "write": "setFlags"
+ },
+ {
+ "constant": false,
+ "designable": true,
+ "final": false,
+ "name": "flagsList",
+ "read": "flagsList",
+ "scriptable": true,
+ "stored": true,
+ "type": "QVector<Foo::Bar::Flags>",
+ "user": false,
+ "write": "setFlagsList"
+ }
+ ],
+ "qualifiedClassName": "Foo::Baz",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "namespaced-flags.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "MyBooooooostishClass",
+ "qualifiedClassName": "MyBooooooostishClass",
+ "signals": [
+ {
+ "access": "public",
+ "name": "mySignal",
+ "returnType": "void"
+ }
+ ],
+ "slots": [
+ {
+ "access": "public",
+ "name": "mySlot",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "no-keywords.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "Derived",
+ "gadget": true,
+ "qualifiedClassName": "NonGadgetParent::Derived",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "Base"
+ }
+ ]
+ }
+ ],
+ "inputFile": "non-gadget-parent-class.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "OldStyleCast",
+ "qualifiedClassName": "OldStyleCast",
+ "slots": [
+ {
+ "access": "public",
+ "name": "foo",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "int"
+ },
+ {
+ "type": "int*"
+ },
+ {
+ "type": "const int*"
+ },
+ {
+ "type": "volatile int*"
+ },
+ {
+ "type": "const int*volatile*"
+ }
+ ],
+ "name": "bar",
+ "returnType": "int"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "int"
+ },
+ {
+ "type": "QObject*const"
+ }
+ ],
+ "name": "slot",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "oldstyle-casts.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
"classInfos": [
{
"name": "TestString",
@@ -1890,17 +1449,44 @@
{
"classes": [
{
- "className": "FunctionWithAttributes",
- "qualifiedClassName": "FunctionWithAttributes",
- "slots": [
+ "className": "TestPluginMetaData",
+ "qualifiedClassName": "TestPluginMetaData",
+ "superClasses": [
{
"access": "public",
- "name": "test1",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "plugin_metadata.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "PureVirtualSignalsTest",
+ "qualifiedClassName": "PureVirtualSignalsTest",
+ "signals": [
+ {
+ "access": "public",
+ "name": "mySignal",
"returnType": "void"
},
{
"access": "public",
- "name": "test2",
+ "name": "myOtherSignal",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "foo",
+ "type": "int"
+ }
+ ],
+ "name": "mySignal2",
"returnType": "void"
}
],
@@ -1910,16 +1496,73 @@
"name": "QObject"
}
]
+ },
+ {
+ "className": "PureVirtualSignalsImpl",
+ "qualifiedClassName": "PureVirtualSignalsImpl",
+ "signals": [
+ {
+ "access": "public",
+ "name": "mySignal",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "foo",
+ "type": "int"
+ }
+ ],
+ "name": "mySignal2",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "PureVirtualSignalsTest"
+ }
+ ]
}
],
- "inputFile": "function-with-attributes.h",
+ "inputFile": "pure-virtual-signals.h",
"outputRevision": 67
},
{
"classes": [
{
- "className": "TestPluginMetaData",
- "qualifiedClassName": "TestPluginMetaData",
+ "className": "InvokableBeforeReturnType",
+ "methods": [
+ {
+ "access": "public",
+ "name": "foo",
+ "returnType": "const char*"
+ }
+ ],
+ "qualifiedClassName": "InvokableBeforeReturnType",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ },
+ {
+ "className": "InvokableBeforeInline",
+ "methods": [
+ {
+ "access": "public",
+ "name": "foo",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "bar",
+ "returnType": "void"
+ }
+ ],
+ "qualifiedClassName": "InvokableBeforeInline",
"superClasses": [
{
"access": "public",
@@ -1928,24 +1571,28 @@
]
}
],
- "inputFile": "plugin_metadata.h",
+ "inputFile": "qinvokable.h",
"outputRevision": 67
},
{
"classes": [
{
- "className": "KDAB",
- "enums": [
+ "className": "TestQPrivateSlots",
+ "methods": [
{
- "isClass": false,
- "isFlag": false,
- "name": "Salaries",
- "values": [
- "Steve"
- ]
+ "access": "private",
+ "name": "method1",
+ "returnType": "void"
+ }
+ ],
+ "qualifiedClassName": "TestQPrivateSlots",
+ "slots": [
+ {
+ "access": "private",
+ "name": "_q_privateslot",
+ "returnType": "void"
}
],
- "qualifiedClassName": "KDAB",
"superClasses": [
{
"access": "public",
@@ -1954,7 +1601,7 @@
]
}
],
- "inputFile": "single-quote-digit-separator-n3781.h",
+ "inputFile": "qprivateslots.h",
"outputRevision": 67
},
{
@@ -1971,14 +1618,15 @@
]
}
],
- "qualifiedClassName": "QTBUG_2151::A",
- "superClasses": [
- {
- "access": "public",
- "name": "QObject"
- }
- ]
- },
+ "gadget": true,
+ "qualifiedClassName": "QTBUG_35657::A"
+ }
+ ],
+ "inputFile": "qtbug-35657-gadget.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
{
"className": "B",
"properties": [
@@ -1994,7 +1642,7 @@
"user": false
}
],
- "qualifiedClassName": "QTBUG_2151::B",
+ "qualifiedClassName": "QTBUG_35657::B",
"superClasses": [
{
"access": "public",
@@ -2003,7 +1651,7 @@
]
}
],
- "inputFile": "related-metaobjects-in-namespaces.h",
+ "inputFile": "related-metaobjects-in-gadget.h",
"outputRevision": 67
},
{
@@ -2020,55 +1668,15 @@
]
}
],
- "gadget": true,
- "qualifiedClassName": "QTBUG_35657::A"
- }
- ],
- "inputFile": "qtbug-35657-gadget.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "Derived",
- "gadget": true,
- "qualifiedClassName": "NonGadgetParent::Derived",
+ "qualifiedClassName": "QTBUG_2151::A",
"superClasses": [
{
"access": "public",
- "name": "Base"
+ "name": "QObject"
}
]
- }
- ],
- "inputFile": "non-gadget-parent-class.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
- "className": "BaseGadget",
- "gadget": true,
- "qualifiedClassName": "GrandParentGadget::BaseGadget"
},
{
- "className": "DerivedGadget",
- "gadget": true,
- "qualifiedClassName": "GrandParentGadget::DerivedGadget",
- "superClasses": [
- {
- "access": "public",
- "name": "Derived"
- }
- ]
- }
- ],
- "inputFile": "grand-parent-gadget-class.h",
- "outputRevision": 67
- },
- {
- "classes": [
- {
"className": "B",
"properties": [
{
@@ -2083,7 +1691,7 @@
"user": false
}
],
- "qualifiedClassName": "QTBUG_35657::B",
+ "qualifiedClassName": "QTBUG_2151::B",
"superClasses": [
{
"access": "public",
@@ -2092,7 +1700,7 @@
]
}
],
- "inputFile": "related-metaobjects-in-gadget.h",
+ "inputFile": "related-metaobjects-in-namespaces.h",
"outputRevision": 67
},
{
@@ -2509,100 +2117,449 @@
{
"classes": [
{
- "className": "FooNamespace",
+ "className": "KDAB",
"enums": [
{
- "isClass": true,
+ "isClass": false,
"isFlag": false,
- "name": "Enum1",
+ "name": "Salaries",
"values": [
- "Key1",
- "Key2"
+ "Steve"
]
}
],
- "gadget": true,
- "qualifiedClassName": "FooNamespace"
+ "qualifiedClassName": "KDAB",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "single-quote-digit-separator-n3781.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "SingleFunctionKeywordBeforeReturnType",
+ "qualifiedClassName": "SingleFunctionKeywordBeforeReturnType",
+ "signals": [
+ {
+ "access": "public",
+ "name": "mySignal",
+ "returnType": "void"
+ }
+ ],
+ "slots": [
+ {
+ "access": "public",
+ "name": "mySlot",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
},
{
- "className": "FooNestedNamespace",
- "enums": [
+ "className": "SingleFunctionKeywordBeforeInline",
+ "qualifiedClassName": "SingleFunctionKeywordBeforeInline",
+ "signals": [
{
- "isClass": true,
- "isFlag": false,
- "name": "Enum2",
- "values": [
- "Key3",
- "Key4"
- ]
- },
+ "access": "public",
+ "name": "mySignal",
+ "returnType": "void"
+ }
+ ],
+ "slots": [
{
- "isClass": true,
- "isFlag": false,
- "name": "Enum3",
- "values": [
- "Key5",
- "Key6"
- ]
+ "access": "public",
+ "name": "mySlot",
+ "returnType": "void"
}
],
- "gadget": true,
- "qualifiedClassName": "FooNamespace::FooNestedNamespace"
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
},
{
- "className": "FooMoreNestedNamespace",
- "enums": [
+ "className": "SingleFunctionKeywordAfterInline",
+ "qualifiedClassName": "SingleFunctionKeywordAfterInline",
+ "signals": [
{
- "isClass": true,
- "isFlag": false,
- "name": "Enum4",
- "values": [
- "Key7",
- "Key8"
- ]
+ "access": "public",
+ "name": "mySignal",
+ "returnType": "void"
}
],
- "gadget": true,
- "qualifiedClassName": "FooNamespace::FooNestedNamespace::FooMoreNestedNamespace"
+ "slots": [
+ {
+ "access": "public",
+ "name": "mySlot",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
}
],
- "inputFile": "namespace.h",
+ "inputFile": "single_function_keyword.h",
"outputRevision": 67
},
{
"classes": [
{
- "className": "ClassInNamespace",
- "enums": [
+ "className": "SlotsWithVoidTemplateTest",
+ "qualifiedClassName": "SlotsWithVoidTemplateTest",
+ "signals": [
{
- "isClass": false,
- "isFlag": false,
- "name": "GadEn",
- "values": [
- "Value"
- ]
+ "access": "public",
+ "arguments": [
+ {
+ "type": "TestTemplate<void>"
+ }
+ ],
+ "name": "mySignal",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "myVoidSignal",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "myVoidSignal2",
+ "returnType": "void"
}
],
- "gadget": true,
- "qualifiedClassName": "CXX17Namespace::A::B::C::D::ClassInNamespace"
+ "slots": [
+ {
+ "access": "public",
+ "name": "dummySlot",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "dummySlot2",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "TestTemplate<void>"
+ }
+ ],
+ "name": "anotherSlot",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "name": "mySlot",
+ "returnType": "TestTemplate<void>"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "slots-with-void-template.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "Task192552",
+ "qualifiedClassName": "Task192552",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "task192552.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "TestObject",
+ "qualifiedClassName": "NS_A::NS_B::TestObject",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
},
{
- "className": "D",
- "enums": [
+ "className": "TestMain",
+ "qualifiedClassName": "NS_A::NS_Main::TestMain",
+ "superClasses": [
{
- "isClass": false,
- "isFlag": false,
- "name": "NamEn",
- "values": [
- "Value"
- ]
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "task234909.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "TypenameWithUnsigned",
+ "qualifiedClassName": "TypenameWithUnsigned",
+ "slots": [
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "uint"
+ }
+ ],
+ "name": "a",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "u",
+ "type": "uint"
+ }
+ ],
+ "name": "b",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "uint*"
+ }
+ ],
+ "name": "c",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "p",
+ "type": "uint*"
+ }
+ ],
+ "name": "d",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "uint&"
+ }
+ ],
+ "name": "e",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "r",
+ "type": "uint&"
+ }
+ ],
+ "name": "f",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "unsigned1"
+ }
+ ],
+ "name": "g",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "u1",
+ "type": "unsigned1"
+ }
+ ],
+ "name": "h",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "uint"
+ },
+ {
+ "type": "unsigned1"
+ }
+ ],
+ "name": "i",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "unsigned1"
+ },
+ {
+ "type": "uint"
+ }
+ ],
+ "name": "j",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "unsignedQImage"
+ }
+ ],
+ "name": "k",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "name": "uqi",
+ "type": "unsignedQImage"
+ }
+ ],
+ "name": "l",
+ "returnType": "void"
}
],
- "gadget": true,
- "qualifiedClassName": "CXX17Namespace::A::B::C::D"
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
}
],
- "inputFile": "cxx17-namespaces.h",
+ "inputFile": "task240368.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "Task87883",
+ "qualifiedClassName": "Task87883",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "task87883.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
+ "className": "Foo",
+ "qualifiedClassName": "BBB::Foo",
+ "signals": [
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QVector<QVector<int> >"
+ }
+ ],
+ "name": "foo",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QVector<QVector<int> >"
+ }
+ ],
+ "name": "foo2",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QVector< ::AAA::BaseA*>"
+ }
+ ],
+ "name": "bar",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QVector< ::AAA::BaseA*>"
+ }
+ ],
+ "name": "bar2",
+ "returnType": "void"
+ },
+ {
+ "access": "public",
+ "arguments": [
+ {
+ "type": "QVector<const ::AAA::BaseA*>"
+ }
+ ],
+ "name": "bar3",
+ "returnType": "void"
+ }
+ ],
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ },
+ {
+ "access": "public",
+ "name": "::AAA::BaseA"
+ }
+ ]
+ }
+ ],
+ "inputFile": "trigraphs.h",
"outputRevision": 67
}
]
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 1794bafd2c..93ca330126 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -15,7 +15,7 @@ cross_compile: DEFINES += MOC_CROSS_COMPILED
HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-newlines.h oldstyle-casts.h \
slots-with-void-template.h qinvokable.h namespaced-flags.h trigraphs.h \
escapes-in-string-literals.h cstyle-enums.h qprivateslots.h gadgetwithnoenums.h \
- dir-in-include-path.h single_function_keyword.h task192552.h task189996.h \
+ dir-in-include-path.h single_function_keyword.h task192552.h \
task234909.h task240368.h pure-virtual-signals.h cxx11-enums.h \
cxx11-final-classes.h \
cxx11-explicit-override-control.h \
diff --git a/tests/auto/tools/moc/task189996.h b/tests/auto/tools/moc/task189996.h
deleted file mode 100644
index f94a051b3a..0000000000
--- a/tests/auto/tools/moc/task189996.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-// inline functions can have throw declarations
-
-#ifndef TASK189996_H
-#define TASK189996_H
-
-#include <QObject>
-
-class InlineSlotsWithThrowDeclaration : public QObject
-{
- Q_OBJECT
-
-public slots:
- void a() throw() { }
- void b() const throw() { }
- void c() throw();
- void d() throw(int) { }
- void e() const throw(int,double) { }
-};
-
-#endif
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 9fc00288fe..36ea101814 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -630,7 +630,6 @@ public:
private slots:
void initTestCase();
- void slotWithException() throw(MyStruct);
void dontStripNamespaces();
void oldStyleCasts();
void warnOnExtraSignalSlotQualifiaction();
@@ -672,7 +671,6 @@ private slots:
void templateGtGt();
void qprivateslots();
void qprivateproperties();
- void inlineSlotsWithThrowDeclaration();
void warnOnPropertyWithoutREAD();
void constructors();
void typenameWithUnsigned();
@@ -781,12 +779,6 @@ void tst_Moc::initTestCase()
#endif
}
-void tst_Moc::slotWithException() throw(MyStruct)
-{
- // be happy
- QVERIFY(true);
-}
-
void tst_Moc::dontStripNamespaces()
{
Sender sender;
@@ -821,7 +813,7 @@ void tst_Moc::oldStyleCasts()
QStringList args;
args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -891,7 +883,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << ".."
- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -1171,7 +1163,7 @@ void tst_Moc::ignoreOptionClashes()
QStringList gccArgs;
gccArgs << "-c" << "-x" << "c++" << "-I" << ".."
<< "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null"
- << "-fPIC" << "-std=c++11" << "-";
+ << "-fPIC" << "-std=c++1z" << "-";
proc.start("gcc", gccArgs);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
@@ -1590,21 +1582,6 @@ void tst_Moc::qprivateproperties()
}
-#include "task189996.h"
-
-void InlineSlotsWithThrowDeclaration::c() throw() {}
-
-void tst_Moc::inlineSlotsWithThrowDeclaration()
-{
- InlineSlotsWithThrowDeclaration tst;
- const QMetaObject *mobj = tst.metaObject();
- QVERIFY(mobj->indexOfSlot("a()") != -1);
- QVERIFY(mobj->indexOfSlot("b()") != -1);
- QVERIFY(mobj->indexOfSlot("c()") != -1);
- QVERIFY(mobj->indexOfSlot("d()") != -1);
- QVERIFY(mobj->indexOfSlot("e()") != -1);
-}
-
void tst_Moc::warnOnPropertyWithoutREAD()
{
#ifdef MOC_CROSS_COMPILED
@@ -1866,7 +1843,7 @@ void tst_Moc::notifyError()
QStringList args;
args << "-c" << "-x" << "c++" << "-I" << "."
- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-";
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++1z" << "-";
proc.start("gcc", args);
QVERIFY(proc.waitForStarted());
proc.write(mocOut);
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 9ae4508bc1..dae274a8b6 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -96,8 +96,9 @@ private slots:
void task248107_backButton();
void task255350_fieldObjectDestroyed();
void taskQTBUG_25691_fieldObjectDestroyed2();
+#if QT_CONFIG(shortcut)
void taskQTBUG_46894_nextButtonShortcut();
-
+#endif
/*
Things that could be added:
@@ -2703,6 +2704,8 @@ void tst_QWizard::taskQTBUG_25691_fieldObjectDestroyed2()
::taskQTBUG_25691_fieldObjectDestroyed2();
}
+#if QT_CONFIG(shortcut)
+
void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
{
for (int i = 0; i < QWizard::NStyles; ++i) {
@@ -2717,5 +2720,7 @@ void tst_QWizard::taskQTBUG_46894_nextButtonShortcut()
}
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QWizard)
#include "tst_qwizard.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 262e1772a0..0010718d3e 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -450,7 +450,9 @@ private slots:
void modality_keyEvents();
void itemIsInFront();
void scenePosChange();
+#if QT_CONFIG(shortcut)
void textItem_shortcuts();
+#endif
void scroll();
void focusHandling_data();
void focusHandling();
@@ -10801,6 +10803,8 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
+#if QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::textItem_shortcuts()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
@@ -10840,6 +10844,8 @@ void tst_QGraphicsItem::textItem_shortcuts()
QTRY_COMPARE(item->textCursor().selectedText(), item->toPlainText());
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::scroll()
{
// Create two overlapping rectangles in the scene:
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index d5813d64ff..bb098f32c2 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -1744,7 +1744,7 @@ void tst_QHeaderView::restoreQt4State()
QCOMPARE(h2.length(), old_length);
QCOMPARE(h2.saveState(), old_state);
#else
- QSKIP("Qt4 compatibility no longer needed in Qt6")
+ QSKIP("Qt4 compatibility no longer needed in Qt6");
#endif
}
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index ea3eb5fd0c..544069243f 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -331,8 +331,10 @@ private slots:
void selectColumn_data();
void selectColumn();
+#if QT_CONFIG(shortcut)
void selectall_data();
void selectall();
+#endif
void visualRect_data();
void visualRect();
@@ -1843,6 +1845,8 @@ void tst_QTableView::selectColumn()
QCOMPARE(view.selectionModel()->selectedIndexes().at(i).column(), column);
}
+#if QT_CONFIG(shortcut)
+
void tst_QTableView::selectall_data()
{
QTest::addColumn<int>("rowCount");
@@ -1999,6 +2003,8 @@ void tst_QTableView::selectall()
QCOMPARE(view.selectedIndexes().count(), 0);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QTableView::visualRect_data()
{
QTest::addColumn<int>("rowCount");
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index af85a2bd13..9d0bf58b03 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -1,7 +1,5 @@
TEMPLATE=subdirs
SUBDIRS=\
- qaction \
- qactiongroup \
qapplication \
qboxlayout \
qdesktopwidget \
@@ -13,7 +11,6 @@ SUBDIRS=\
qtooltip \
qwidget \
qwidget_window \
- qwidgetaction \
qwidgetmetatype \
qwidgetsvariant \
qwindowcontainer \
@@ -22,3 +19,11 @@ SUBDIRS=\
darwin:SUBDIRS -= \ # Uses native recognizers
qgesturerecognizer \
+
+!qtConfig(action):SUBDIRS -= \
+ qaction \
+ qactiongroup \
+ qwidgetaction
+
+!qtConfig(shortcut): SUBDIRS -= \
+ qshortcut
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 1247f48dd0..cf8539da68 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -50,30 +50,25 @@ public:
private slots:
void init();
void cleanup();
- void getSetCheck();
- void setText_data();
- void setText();
- void setIconText_data() { setText_data(); }
- void setIconText();
void setUnknownFont();
void actionEvent();
- void setStandardKeys();
+#if QT_CONFIG(shortcut)
void alternateShortcuts();
void enabledVisibleInteraction();
- void task200823_tooltip();
- void task229128TriggeredSignalWithoutActiongroup();
+#endif
void task229128TriggeredSignalWhenInActiongroup();
+#if QT_CONFIG(shortcut)
void repeat();
- void setData();
void keysequence(); // QTBUG-53381
void disableShortcutsWithBlockedWidgets_data();
void disableShortcutsWithBlockedWidgets();
void shortcutFromKeyEvent(); // QTBUG-48325
+#endif
private:
QEvent::Type m_lastEventType;
const int m_keyboardScheme;
- QAction *m_lastAction;
+ QGuiAction *m_lastAction;
};
tst_QAction::tst_QAction()
@@ -92,33 +87,6 @@ void tst_QAction::cleanup()
QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
-// Testing get/set functions
-void tst_QAction::getSetCheck()
-{
- QAction obj1(nullptr);
- // QActionGroup * QAction::actionGroup()
- // void QAction::setActionGroup(QActionGroup *)
- QActionGroup *var1 = new QActionGroup(nullptr);
- obj1.setActionGroup(var1);
- QCOMPARE(var1, obj1.actionGroup());
- obj1.setActionGroup(nullptr);
- QCOMPARE(obj1.actionGroup(), nullptr);
- delete var1;
-
- // QMenu * QAction::menu()
- // void QAction::setMenu(QMenu *)
- QMenu *var2 = new QMenu(nullptr);
- obj1.setMenu(var2);
- QCOMPARE(var2, obj1.menu());
- obj1.setMenu(nullptr);
- QCOMPARE(obj1.menu(), nullptr);
- delete var2;
-
- QCOMPARE(obj1.priority(), QAction::NormalPriority);
- obj1.setPriority(QAction::LowPriority);
- QCOMPARE(obj1.priority(), QAction::LowPriority);
-}
-
class MyWidget : public QWidget
{
Q_OBJECT
@@ -133,43 +101,6 @@ private:
tst_QAction *m_test;
};
-void tst_QAction::setText_data()
-{
- QTest::addColumn<QString>("text");
- QTest::addColumn<QString>("iconText");
- QTest::addColumn<QString>("textFromIconText");
-
- //next we fill it with data
- QTest::newRow("Normal") << "Action" << "Action" << "Action";
- QTest::newRow("Ampersand") << "Search && Destroy" << "Search & Destroy" << "Search && Destroy";
- QTest::newRow("Mnemonic and ellipsis") << "O&pen File ..." << "Open File" << "Open File";
-}
-
-void tst_QAction::setText()
-{
- QFETCH(QString, text);
-
- QAction action(nullptr);
- action.setText(text);
-
- QCOMPARE(action.text(), text);
-
- QFETCH(QString, iconText);
- QCOMPARE(action.iconText(), iconText);
-}
-
-void tst_QAction::setIconText()
-{
- QFETCH(QString, iconText);
-
- QAction action(nullptr);
- action.setIconText(iconText);
- QCOMPARE(action.iconText(), iconText);
-
- QFETCH(QString, textFromIconText);
- QCOMPARE(action.text(), textFromIconText);
-}
-
void tst_QAction::setUnknownFont() // QTBUG-42728
{
QAction action(nullptr);
@@ -221,34 +152,7 @@ void tst_QAction::actionEvent()
QCOMPARE(m_lastAction, &a);
}
-//basic testing of standard keys
-void tst_QAction::setStandardKeys()
-{
- QAction act(nullptr);
- act.setShortcut(QKeySequence("CTRL+L"));
- QList<QKeySequence> list;
- act.setShortcuts(list);
- act.setShortcuts(QKeySequence::Copy);
- QCOMPARE(act.shortcut(), act.shortcuts().constFirst());
-
- QList<QKeySequence> expected;
- const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
- const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
- switch (m_keyboardScheme) {
- case QPlatformTheme::MacKeyboardScheme:
- expected << ctrlC;
- break;
- case QPlatformTheme::WindowsKeyboardScheme:
- expected << ctrlC << ctrlInsert;
- break;
- default: // X11
- expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16"));
- break;
- }
-
- QCOMPARE(act.shortcuts(), expected);
-}
-
+#if QT_CONFIG(shortcut)
void tst_QAction::alternateShortcuts()
{
@@ -354,38 +258,7 @@ void tst_QAction::enabledVisibleInteraction()
QCOMPARE(spy.count(), 1); //act is visible and enabled, so trigger
}
-void tst_QAction::task200823_tooltip()
-{
- const QScopedPointer<QAction> action(new QAction("foo", nullptr));
- QString shortcut("ctrl+o");
- action->setShortcut(shortcut);
-
- // we want a non-standard tooltip that shows the shortcut
- action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')'));
-
- QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')');
- QCOMPARE(action->toolTip(), ref);
-}
-
-void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
-{
- // test without a group
- const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", nullptr));
- QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), QOverload<bool>::of(&QAction::triggered));
- QCOMPARE(spyWithoutGroup.count(), 0);
- actionWithoutGroup->trigger();
- // signal should be emitted
- QCOMPARE(spyWithoutGroup.count(), 1);
-
- // it is now a checkable checked action
- actionWithoutGroup->setCheckable(true);
- actionWithoutGroup->setChecked(true);
- spyWithoutGroup.clear();
- QCOMPARE(spyWithoutGroup.count(), 0);
- actionWithoutGroup->trigger();
- // signal should be emitted
- QCOMPARE(spyWithoutGroup.count(), 1);
-}
+#endif // QT_CONFIG(shortcut)
void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
{
@@ -408,6 +281,8 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
QCOMPARE(actionSpy.count(), 1);
}
+#if QT_CONFIG(shortcut)
+
void tst_QAction::repeat()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -452,21 +327,6 @@ void tst_QAction::repeat()
QCOMPARE(spy.count(), 2);
}
-void tst_QAction::setData() // QTBUG-62006
-{
- QAction act(nullptr);
- QSignalSpy spy(&act, &QAction::changed);
- QCOMPARE(act.data(), QVariant());
- QCOMPARE(spy.count(), 0);
- act.setData(QVariant());
- QCOMPARE(spy.count(), 0);
-
- act.setData(-1);
- QCOMPARE(spy.count(), 1);
- act.setData(-1);
- QCOMPARE(spy.count(), 1);
-}
-
void tst_QAction::disableShortcutsWithBlockedWidgets_data()
{
QTest::addColumn<Qt::ShortcutContext>("shortcutContext");
@@ -556,5 +416,7 @@ void tst_QAction::shortcutFromKeyEvent()
QCOMPARE(testWidget.shortcutOverrideCount, 1);
}
+#endif // QT_CONFIG(shortcut)
+
QTEST_MAIN(tst_QAction)
#include "tst_qaction.moc"
diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
index 524040d003..d3b07ba26a 100644
--- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
+++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
@@ -38,166 +38,9 @@ class tst_QActionGroup : public QObject
private slots:
void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); }
- void enabledPropagation();
- void visiblePropagation();
- void exclusive();
- void exclusiveOptional();
void separators();
- void testActionInTwoQActionGroup();
- void unCheckCurrentAction();
};
-void tst_QActionGroup::enabledPropagation()
-{
- QActionGroup testActionGroup(nullptr);
-
- QAction* childAction = new QAction( &testActionGroup );
- QAction* anotherChildAction = new QAction( &testActionGroup );
- QAction* freeAction = new QAction(nullptr);
-
- QVERIFY( testActionGroup.isEnabled() );
- QVERIFY( childAction->isEnabled() );
-
- testActionGroup.setEnabled( false );
- QVERIFY( !testActionGroup.isEnabled() );
- QVERIFY( !childAction->isEnabled() );
- QVERIFY( !anotherChildAction->isEnabled() );
-
- childAction->setEnabled(true);
- QVERIFY( !childAction->isEnabled());
-
- anotherChildAction->setEnabled( false );
-
- testActionGroup.setEnabled( true );
- QVERIFY( testActionGroup.isEnabled() );
- QVERIFY( childAction->isEnabled() );
- QVERIFY( !anotherChildAction->isEnabled() );
-
- testActionGroup.setEnabled( false );
- QAction *lastChildAction = new QAction(&testActionGroup);
-
- QVERIFY(!lastChildAction->isEnabled());
- testActionGroup.setEnabled( true );
- QVERIFY(lastChildAction->isEnabled());
-
- freeAction->setEnabled(false);
- testActionGroup.addAction(freeAction);
- QVERIFY(!freeAction->isEnabled());
- delete freeAction;
-}
-
-void tst_QActionGroup::visiblePropagation()
-{
- QActionGroup testActionGroup(nullptr);
-
- QAction* childAction = new QAction( &testActionGroup );
- QAction* anotherChildAction = new QAction( &testActionGroup );
- QAction* freeAction = new QAction(nullptr);
-
- QVERIFY( testActionGroup.isVisible() );
- QVERIFY( childAction->isVisible() );
-
- testActionGroup.setVisible( false );
- QVERIFY( !testActionGroup.isVisible() );
- QVERIFY( !childAction->isVisible() );
- QVERIFY( !anotherChildAction->isVisible() );
-
- anotherChildAction->setVisible(false);
-
- testActionGroup.setVisible( true );
- QVERIFY( testActionGroup.isVisible() );
- QVERIFY( childAction->isVisible() );
-
- QVERIFY( !anotherChildAction->isVisible() );
-
- testActionGroup.setVisible( false );
- QAction *lastChildAction = new QAction(&testActionGroup);
-
- QVERIFY(!lastChildAction->isVisible());
- testActionGroup.setVisible( true );
- QVERIFY(lastChildAction->isVisible());
-
- freeAction->setVisible(false);
- testActionGroup.addAction(freeAction);
- QVERIFY(!freeAction->isVisible());
- delete freeAction;
-}
-
-void tst_QActionGroup::exclusive()
-{
- QActionGroup group(nullptr);
- group.setExclusive(false);
- QVERIFY( !group.isExclusive() );
-
- QAction* actOne = new QAction( &group );
- actOne->setCheckable( true );
- QAction* actTwo = new QAction( &group );
- actTwo->setCheckable( true );
- QAction* actThree = new QAction( &group );
- actThree->setCheckable( true );
-
- group.setExclusive( true );
- QVERIFY( !actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actOne->setChecked( true );
- QVERIFY( actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actTwo->setChecked( true );
- QVERIFY( !actOne->isChecked() );
- QVERIFY( actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-}
-
-void tst_QActionGroup::exclusiveOptional()
-{
- QActionGroup group(0);
- group.setExclusive(true);
- QVERIFY( group.isExclusive() );
-
- QAction* actOne = new QAction( &group );
- actOne->setCheckable( true );
- QAction* actTwo = new QAction( &group );
- actTwo->setCheckable( true );
- QAction* actThree = new QAction( &group );
- actThree->setCheckable( true );
-
- QVERIFY( !actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actOne->trigger();
- QVERIFY( actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actOne->trigger();
- QVERIFY( actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- group.setExclusionPolicy( QActionGroup::ExclusionPolicy::ExclusiveOptional );
- QVERIFY( group.isExclusive() );
-
- actOne->trigger();
- QVERIFY( !actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actTwo->trigger();
- QVERIFY( !actOne->isChecked() );
- QVERIFY( actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-
- actTwo->trigger();
- QVERIFY( !actOne->isChecked() );
- QVERIFY( !actTwo->isChecked() );
- QVERIFY( !actThree->isChecked() );
-}
-
void tst_QActionGroup::separators()
{
QMainWindow mw;
@@ -233,40 +76,5 @@ void tst_QActionGroup::separators()
QCOMPARE(menu.actions().size(), 3);
}
-void tst_QActionGroup::testActionInTwoQActionGroup()
-{
- QAction action1("Action 1", this);
-
- QActionGroup group1(this);
- QActionGroup group2(this);
-
- group1.addAction(&action1);
- group2.addAction(&action1);
-
- QCOMPARE(action1.actionGroup(), &group2);
- QCOMPARE(group2.actions().first(), &action1);
- QCOMPARE(group1.actions().isEmpty(), true);
-}
-
-void tst_QActionGroup::unCheckCurrentAction()
-{
- QActionGroup group(nullptr);
- QAction action1(&group) ,action2(&group);
- action1.setCheckable(true);
- action2.setCheckable(true);
- QVERIFY(!action1.isChecked());
- QVERIFY(!action2.isChecked());
- action1.setChecked(true);
- QVERIFY(action1.isChecked());
- QVERIFY(!action2.isChecked());
- QAction *current = group.checkedAction();
- QCOMPARE(current, &action1);
- current->setChecked(false);
- QVERIFY(!action1.isChecked());
- QVERIFY(!action2.isChecked());
- QVERIFY(!group.checkedAction());
-}
-
-
QTEST_MAIN(tst_QActionGroup)
#include "tst_qactiongroup.moc"
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index c6760000f4..45a35fe4f1 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -99,7 +99,9 @@ class tst_QFormLayout : public QObject
private slots:
void cleanup();
void rowCount();
+#if QT_CONFIG(shortcut)
void buddies();
+#endif
void getItemPosition();
void wrapping();
void spacing();
@@ -190,6 +192,8 @@ void tst_QFormLayout::rowCount()
//TODO: remove items
}
+#if QT_CONFIG(shortcut)
+
void tst_QFormLayout::buddies()
{
QWidget w;
@@ -218,6 +222,8 @@ void tst_QFormLayout::buddies()
//TODO: empty label?
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QFormLayout::getItemPosition()
{
QWidget w;
@@ -687,17 +693,21 @@ void tst_QFormLayout::insertRow_QString_QWidget()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label1->buddy(), fld1);
-
+#endif
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label2->buddy(), fld2);
-
+#endif
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
+#if QT_CONFIG(shortcut)
QCOMPARE(label3->buddy(), fld3);
+#endif
}
void tst_QFormLayout::insertRow_QString_QLayout()
@@ -711,21 +721,27 @@ void tst_QFormLayout::insertRow_QString_QLayout()
layout->insertRow(-5, "&Name:", fld1);
QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label1 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label1->buddy());
+#endif
QCOMPARE(layout->rowCount(), 1);
layout->insertRow(0, "&Email:", fld2);
QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget());
QVERIFY(label2 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label2->buddy());
+#endif
QCOMPARE(layout->rowCount(), 2);
layout->insertRow(5, "&Age:", fld3);
QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget());
QVERIFY(label3 != 0);
+#if QT_CONFIG(shortcut)
QVERIFY(!label3->buddy());
+#endif
QCOMPARE(layout->rowCount(), 3);
}
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
index eb108a40de..e5a891912f 100644
--- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
+++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
@@ -34,7 +34,9 @@
#include <qapplication.h>
#include <qpainter.h>
#include <qstyleoption.h>
-#include <qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <qkeysequence.h>
+#endif
#include <qevent.h>
#include <qgridlayout.h>
#include <qabstractbutton.h>
@@ -59,7 +61,9 @@ private slots:
void setText();
void setIcon();
+#if QT_CONFIG(shortcut)
void setShortcut();
+#endif
void animateClick();
@@ -68,7 +72,9 @@ private slots:
void isChecked();
void toggled();
void setEnabled();
+#if QT_CONFIG(shortcut)
void shortcutEvents();
+#endif
void stopRepeatTimer();
void mouseReleased(); // QTBUG-53244
@@ -164,8 +170,10 @@ void tst_QAbstractButton::init()
testWidget->setEnabled( true );
testWidget->setDown( false );
testWidget->setAutoRepeat( false );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
toggle_count = 0;
press_count = 0;
@@ -336,17 +344,17 @@ void tst_QAbstractButton::setText()
QCOMPARE( testWidget->text(), QString("simple") );
testWidget->setText("&ampersand");
QCOMPARE( testWidget->text(), QString("&ampersand") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+A"));
#endif
testWidget->setText("te&st");
QCOMPARE( testWidget->text(), QString("te&st") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+S"));
#endif
testWidget->setText("foo");
QCOMPARE( testWidget->text(), QString("foo") );
-#ifndef Q_OS_MAC // no mneonics on Mac.
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac.
QCOMPARE( testWidget->shortcut(), QKeySequence());
#endif
}
@@ -471,6 +479,7 @@ void tst_QAbstractButton::toggled()
testWidget->setCheckable(false);
}
+#if QT_CONFIG(shortcut)
void tst_QAbstractButton::setShortcut()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
@@ -502,6 +511,7 @@ void tst_QAbstractButton::setShortcut()
// qDebug() << click_count;
}
+#endif // QT_CONFIG(shortcut)
void tst_QAbstractButton::animateClick()
{
@@ -512,6 +522,8 @@ void tst_QAbstractButton::animateClick()
QTRY_VERIFY( !testWidget->isDown() );
}
+#if QT_CONFIG(shortcut)
+
void tst_QAbstractButton::shortcutEvents()
{
MyButton button;
@@ -535,6 +547,8 @@ void tst_QAbstractButton::shortcutEvents()
QCOMPARE(clickedSpy.count(), 3);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QAbstractButton::stopRepeatTimer()
{
MyButton button;
diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
index 0044d33c66..45a23984e0 100644
--- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
+++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp
@@ -51,7 +51,9 @@ private slots:
void getSetCheck();
void pressed();
+#if QT_CONFIG(shortcut)
void setAccel();
+#endif
void isCheckable();
void setDown();
void popupCrash();
@@ -133,8 +135,10 @@ void tst_QCommandLinkButton::init()
testWidget->setText("Test");
testWidget->setDescription("Description text.");
testWidget->setEnabled( true );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
resetCounters();
}
@@ -327,6 +331,8 @@ void tst_QCommandLinkButton::toggled()
QVERIFY( click_count == 1 );
}
+#if QT_CONFIG(shortcut)
+
/*
If we press an accelerator key we ONLY get a pressed signal and
NOT a released or clicked signal.
@@ -355,6 +361,8 @@ void tst_QCommandLinkButton::setAccel()
QTest::qWait(200);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QCommandLinkButton::animateClick()
{
QVERIFY( !testWidget->isDown() );
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index c293a4bdd2..c6de750482 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -166,7 +166,9 @@ private slots:
void doubleDot();
+#if QT_CONFIG(shortcut)
void undoRedo();
+#endif
void valueFromTextAndValidate_data();
void valueFromTextAndValidate();
@@ -1025,6 +1027,8 @@ void tst_QDoubleSpinBox::doubleDot()
QCOMPARE(spin.lineEdit()->cursorPosition(), 2);
}
+#if QT_CONFIG(shortcut)
+
void tst_QDoubleSpinBox::undoRedo()
{
//test undo/redo feature (in conjunction with the "undoRedoEnabled" property)
@@ -1073,6 +1077,8 @@ void tst_QDoubleSpinBox::undoRedo()
QVERIFY(!spin.lineEdit()->isRedoAvailable());
}
+#endif // QT_CONFIG(shortcut)
+
struct task199226_DoubleSpinBox : public QDoubleSpinBox
{
task199226_DoubleSpinBox(QWidget *parent = 0) : QDoubleSpinBox(parent) {}
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index f599ac73c6..7760e12cca 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -68,7 +68,7 @@ private Q_SLOTS:
void setText_data();
void setText();
void setTextFormat();
-#ifndef Q_OS_MAC
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
void setBuddy();
#endif
void setNum();
@@ -88,8 +88,10 @@ private Q_SLOTS:
void unicodeText_data();
void unicodeText();
+#if QT_CONFIG(shortcut)
void mnemonic_data();
void mnemonic();
+#endif
void selection();
#ifndef QT_NO_CONTEXTMENU
@@ -116,6 +118,7 @@ void tst_QLabel::getSetCheck()
obj1.setWordWrap(true);
QCOMPARE(true, obj1.wordWrap());
+#if QT_CONFIG(shortcut)
// QWidget * QLabel::buddy()
// void QLabel::setBuddy(QWidget *)
QWidget *var2 = new QWidget();
@@ -124,6 +127,7 @@ void tst_QLabel::getSetCheck()
obj1.setBuddy((QWidget *)0);
QCOMPARE((QWidget *)0, obj1.buddy());
delete var2;
+#endif // QT_CONFIG(shortcut)
// QMovie * QLabel::movie()
// void QLabel::setMovie(QMovie *)
@@ -153,7 +157,9 @@ void tst_QLabel::cleanupTestCase()
void tst_QLabel::init()
{
testWidget->setTextFormat( Qt::AutoText );
+# if QT_CONFIG(shortcut)
testWidget->setBuddy( 0 );
+#endif
testWidget->setIndent( 0 );
testWidget->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
testWidget->setScaledContents( false );
@@ -169,7 +175,7 @@ void tst_QLabel::cleanup()
}
// Set buddy doesn't make much sense on OS X
-#ifndef Q_OS_MAC
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
void tst_QLabel::setBuddy()
{
testWidget->hide();
@@ -204,7 +210,7 @@ void tst_QLabel::setBuddy()
delete test_box;
}
-#endif
+#endif // QT_CONFIG(shortcut) && !Q_OS_DARWIN
void tst_QLabel::setText_data()
{
@@ -469,6 +475,8 @@ void tst_QLabel::unicodeText()
testWidget->show();
}
+#if QT_CONFIG(shortcut)
+
void tst_QLabel::mnemonic_data()
{
QTest::addColumn<QString>("text");
@@ -513,6 +521,8 @@ void tst_QLabel::mnemonic()
QCOMPARE(d->shortcutCursor.selectedText(), expectedShortcutCursor);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLabel::selection()
{
QLabel label;
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 5845819267..c2475be8b4 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -56,7 +56,9 @@
#include <qsortfilterproxymodel.h>
#include <qdebug.h>
#include <qscreen.h>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
#include "qcommonstyle.h"
#include "qstyleoption.h"
@@ -133,9 +135,11 @@ private slots:
void clearInputMask();
+#if QT_CONFIG(shortcut)
void keypress_inputMask_data();
void keypress_inputMask();
void keypress_inputMethod_inputMask();
+#endif
void inputMaskAndValidator_data();
void inputMaskAndValidator();
@@ -217,7 +221,7 @@ private slots:
void setSelection_data();
void setSelection();
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
void cut();
void cutWithoutSelection();
#endif
@@ -297,8 +301,10 @@ private slots:
void shouldShowPlaceholderText();
void QTBUG1266_setInputMaskEmittingTextEdited();
+#if QT_CONFIG(shortcut)
void shortcutOverrideOnReadonlyLineEdit_data();
void shortcutOverrideOnReadonlyLineEdit();
+#endif
void QTBUG59957_clearButtonLeftmostAction();
void QTBUG_60319_setInputMaskCheckImSurroundingText();
void testQuickSelectionWithMouse();
@@ -317,7 +323,9 @@ private:
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = {});
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = {});
bool unselectingWithLeftOrRightChangesCursorPosition();
+#if QT_CONFIG(shortcut)
void addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey);
+#endif
QLineEdit *ensureTestWidget();
bool validInput;
@@ -713,6 +721,8 @@ void tst_QLineEdit::clearInputMask()
QCOMPARE(testWidget->inputMask(), QString());
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::keypress_inputMask_data()
{
QTest::addColumn<QString>("mask");
@@ -838,6 +848,8 @@ void tst_QLineEdit::keypress_inputMethod_inputMask()
QCOMPARE(testWidget->text(), QStringLiteral("EE.EE.EE"));
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::hasAcceptableInputMask_data()
{
QTest::addColumn<QString>("optionalMask");
@@ -1992,6 +2004,8 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo
keys.addKeyClick(key, pressState);
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey key)
{
QKeySequence keyseq = QKeySequence(key);
@@ -1999,6 +2013,8 @@ void tst_QLineEdit::addKeySequenceStandardKey(QTestEventList &keys, QKeySequence
keys.addKeyClick( Qt::Key( keyseq[i] & ~Qt::KeyboardModifierMask), Qt::KeyboardModifier(keyseq[i] & Qt::KeyboardModifierMask) );
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::cursorPosition()
{
QLineEdit *testWidget = ensureTestWidget();
@@ -3029,7 +3045,7 @@ void tst_QLineEdit::setSelection()
QCOMPARE(testWidget->cursorPosition(), expectedCursor);
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
void tst_QLineEdit::cut()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -3130,7 +3146,7 @@ void tst_QLineEdit::cutWithoutSelection()
QCOMPARE(clipboard->text(), origText.left(selectionLength));
}
-#endif // !QT_NO_CLIPBOARD
+#endif // QT_CONFIG(clipboard) && QT_CONFIG(shortcut)
class InputMaskValidator : public QValidator
{
@@ -3978,7 +3994,9 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
le.setReadOnly(true);
QAction action(QString::fromLatin1("hello"), &le);
+#if QT_CONFIG(shortcut)
action.setShortcut(QString::fromLatin1("p"));
+#endif
QSignalSpy spy(&action, SIGNAL(triggered()));
le.addAction(&action);
@@ -4713,6 +4731,8 @@ void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited()
QCOMPARE(spy.count(), 0);
}
+#if QT_CONFIG(shortcut)
+
void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit_data()
{
QTest::addColumn<QKeySequence>("keySequence");
@@ -4772,6 +4792,8 @@ void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit()
QCOMPARE(spy.count(), activationCount);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QLineEdit::QTBUG59957_clearButtonLeftmostAction()
{
#ifndef QT_BUILD_INTERNAL
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 1e20b7598f..2d74c20469 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -481,7 +481,7 @@ void tst_QMenu::overrideMenuAction()
// On Mac and Windows CE, we need to create native key events to test menu
// action activation, so skip this part of the test.
-#if !defined(Q_OS_DARWIN)
+#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN)
QAction *aQuit = new QAction("Quit", &w);
aQuit->setShortcut(QKeySequence("Ctrl+X"));
m->addAction(aQuit);
@@ -499,7 +499,7 @@ void tst_QMenu::overrideMenuAction()
//test if the menu still pops out
QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier);
QTRY_VERIFY(m->isVisible());
-#endif
+#endif // QT_CONFIG(shortcut) && !Q_OS_DARWIN
delete aFileMenu;
@@ -1706,10 +1706,13 @@ void tst_QMenu::QTBUG_61039_menu_shortcuts()
QSKIP("Window activation is not supported");
QAction *actionKamen = new QAction("Action Kamen");
+#if QT_CONFIG(shortcut)
actionKamen->setShortcut(QKeySequence(QLatin1String("K")));
-
+#endif
QAction *actionJoe = new QAction("Action Joe");
+#if QT_CONFIG(shortcut)
actionJoe->setShortcut(QKeySequence(QLatin1String("Ctrl+J")));
+#endif
QMenu menu;
menu.addAction(actionKamen);
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index b255930138..8cbe821a68 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -232,19 +232,25 @@ TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb, bool forceNonNative) {
connect(mb, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
QMenu *menu = mb->addMenu(QStringLiteral("&accel"));
QAction *action = menu->addAction(QStringLiteral("menu1") );
+#if QT_CONFIG(shortcut)
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
+#endif
connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*)));
result.menus << menu;
result.actions << action;
menu = mb->addMenu(QStringLiteral("accel1"));
action = menu->addAction(QStringLiteral("&Open...") );
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::Key_O);
+#endif
result.actions << action;
action = menu->addAction(QStringLiteral("action"));
+#if QT_CONFIG(shortcut)
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Z));
+#endif
result.actions << action;
result.menus << menu;
@@ -283,7 +289,9 @@ QAction *tst_QMenuBar::createCharacterAction(QMenu *menu, char lowerAscii)
QAction *action = menu->addAction(text);
action->setObjectName(text);
action->setData(QVariant(int(lowerAscii)));
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::CTRL + (lowerAscii - 'a' + Qt::Key_A));
+#endif
connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered()));
return action;
}
@@ -318,7 +326,9 @@ TestMenu tst_QMenuBar::initComplexMenuBar(QMenuBar *mb)
QAction *action = mb->addAction(QStringLiteral("M&enu 3"));
action->setData(QVariant(3));
+#if QT_CONFIG(shortcut)
action->setShortcut(Qt::ALT + Qt::Key_J);
+#endif
connect(action, SIGNAL(triggered()), this, SLOT(onComplexActionTriggered()));
result.actions << action;
@@ -1422,7 +1432,9 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
menubar.setNativeMenuBar(false);
QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu);
+#if QT_CONFIG(shortcut)
menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC"));
+#endif
centerOnScreen(&menubar);
menubar.show();
QApplication::setActiveWindow(&menubar);
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 6f4838be7a..d0ed68c0c8 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -53,7 +53,9 @@ private slots:
void getSetCheck();
void autoRepeat();
void pressed();
+#if QT_CONFIG(shortcut)
void setAccel();
+#endif
void isCheckable();
void setDown();
void popupCrash();
@@ -65,7 +67,9 @@ private slots:
void defaultAndAutoDefault();
void sizeHint_data();
void sizeHint();
+#if QT_CONFIG(shortcut)
void taskQTBUG_20191_shortcutWithKeypadModifer();
+#endif
void emitReleasedAfterChange();
protected slots:
@@ -125,8 +129,10 @@ void tst_QPushButton::init()
testWidget->setDown( false );
testWidget->setText("Test");
testWidget->setEnabled( true );
+#if QT_CONFIG(shortcut)
QKeySequence seq;
testWidget->setShortcut( seq );
+#endif
resetCounters();
}
@@ -318,6 +324,8 @@ void tst_QPushButton::toggled()
QVERIFY( click_count == 1 );
}
+#if QT_CONFIG(shortcut)
+
/*
If we press an accelerator key we ONLY get a pressed signal and
NOT a released or clicked signal.
@@ -349,6 +357,8 @@ void tst_QPushButton::setAccel()
QTRY_VERIFY( !testWidget->isDown() );
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QPushButton::animateClick()
{
QVERIFY( !testWidget->isDown() );
@@ -571,6 +581,8 @@ void tst_QPushButton::sizeHint()
}
}
+#if QT_CONFIG(shortcut)
+
void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
{
// setup a dialog with two buttons
@@ -617,6 +629,8 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
QCOMPARE(spy2.count(), 1);
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QPushButton::emitReleasedAfterChange()
{
QPushButton *button1 = new QPushButton("A");
diff --git a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
index 7123acfdc3..5c7d3bf1e9 100644
--- a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
+++ b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp
@@ -44,12 +44,16 @@ public:
virtual ~tst_QRadioButton(){};
private slots:
+#if QT_CONFIG(shortcut)
void task190739_focus();
+#endif
void minimumSizeHint();
private:
};
+#if QT_CONFIG(shortcut)
+
void tst_QRadioButton::task190739_focus()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
@@ -84,6 +88,7 @@ void tst_QRadioButton::task190739_focus()
QVERIFY(!radio1.hasFocus());
}
+#endif // QT_CONFIG(shortcut)
void tst_QRadioButton::minimumSizeHint()
{
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 30c57c73e5..b5d2e68118 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -47,7 +47,9 @@
#include <QLocale>
#include <QDoubleSpinBox>
#include <QVBoxLayout>
-#include <QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QKeySequence>
+#endif
#include <QStackedWidget>
#include <QDebug>
#include <QStyleOptionSpinBox>
@@ -173,7 +175,10 @@ private slots:
void removeAll();
void startWithDash();
+
+#if QT_CONFIG(shortcut)
void undoRedo();
+#endif
void specialValue();
void textFromValue();
@@ -1024,6 +1029,8 @@ void tst_QSpinBox::startWithDash()
QCOMPARE(spin.text(), QString("0"));
}
+#if QT_CONFIG(shortcut)
+
void tst_QSpinBox::undoRedo()
{
//test undo/redo feature (in conjunction with the "undoRedoEnabled" property)
@@ -1076,6 +1083,8 @@ void tst_QSpinBox::undoRedo()
QVERIFY(!spin.lineEdit()->isRedoAvailable());
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QSpinBox::specialValue()
{
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
index 61252831ed..1d5ac7c819 100644
--- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
+++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp
@@ -40,7 +40,9 @@
#include <qwidgetaction.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
-#include <qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <qkeysequence.h>
+#endif
#include <qmenu.h>
#include <qlabel.h>
#include <private/qtoolbarextension_p.h>
diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro
index c6325aac15..66950fa85a 100644
--- a/tests/auto/widgets/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets/widgets.pro
@@ -47,6 +47,9 @@ SUBDIRS=\
qtoolbox \
qtoolbutton \
+!qtConfig(shortcut): SUBDIRS -= \
+ qkeysequenceedit
+
# The following tests depend on private API:
!qtConfig(private_tests): SUBDIRS -= \
qabstractspinbox \
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index ab62307704..afab31b382 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -33,7 +33,7 @@
#include <QDebug>
#include <QFile>
#include <QList>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QTextStream>
#include <QtTest/QtTest>
#include <QtXml>
@@ -514,10 +514,10 @@ void tst_QDom::save_data()
QTest::addColumn<int>("indent");
QTest::addColumn<QString>("res");
- QTest::newRow( "01" ) << doc01 << 0 << QString(doc01).replace( QRegExp(" "), "" );
+ QTest::newRow( "01" ) << doc01 << 0 << QString(doc01).replace( QRegularExpression(" "), "" );
QTest::newRow( "02" ) << doc01 << 1 << doc01;
- QTest::newRow( "03" ) << doc01 << 2 << QString(doc01).replace( QRegExp(" "), " " );
- QTest::newRow( "04" ) << doc01 << 10 << QString(doc01).replace( QRegExp(" "), " " );
+ QTest::newRow( "03" ) << doc01 << 2 << QString(doc01).replace( QRegularExpression(" "), " " );
+ QTest::newRow( "04" ) << doc01 << 10 << QString(doc01).replace( QRegularExpression(" "), " " );
}
void tst_QDom::save()