summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-12-04 09:58:43 +0100
committerLiang Qi <liang.qi@qt.io>2018-12-04 09:58:43 +0100
commit5d5c00c67682bce105197b659687fd1fee8f60cf (patch)
tree686e41dc3ea121235fb73afb9157ed603f1bfeff /tests/auto
parentf213e818f03d35cb82e3daf187415197fd156f8e (diff)
parentb82559244e2dc03f1ceff66bb67630df4300dc7c (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qlogging/BLACKLIST4
-rw-r--r--tests/auto/corelib/io/qstandardpaths/BLACKLIST3
-rw-r--r--tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro3
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp6
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp8
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri13
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro73
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro41
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro3
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro9
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro2
-rw-r--r--tests/auto/corelib/serialization/qtextstream/test/test.pro2
-rw-r--r--tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp5
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp156
-rw-r--r--tests/auto/gui/text/qfontdatabase/testdata.qrc1
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp29
-rw-r--r--tests/auto/network/access/http2/http2.pro3
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp5
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp12
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp28
-rw-r--r--tests/auto/other/lancelot/paintcommands.h1
-rw-r--r--tests/auto/other/lancelot/scripts/richtext.qps9
-rw-r--r--tests/auto/other/qobjectrace/qobjectrace.pro3
-rw-r--r--tests/auto/other/qobjectrace/tst_qobjectrace.cpp4
-rw-r--r--tests/auto/shared/resources/testfont_italic.ttfbin0 -> 64136 bytes
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp3
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp3
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp9
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp12
-rw-r--r--tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp39
30 files changed, 390 insertions, 99 deletions
diff --git a/tests/auto/corelib/global/qlogging/BLACKLIST b/tests/auto/corelib/global/qlogging/BLACKLIST
index 1dcee92361..e474064f54 100644
--- a/tests/auto/corelib/global/qlogging/BLACKLIST
+++ b/tests/auto/corelib/global/qlogging/BLACKLIST
@@ -1,3 +1,7 @@
+[qMessagePattern:backtrace]
+# QTBUG-63915
+b2qt 64bit
+
[qMessagePattern:backtrace depth,separator]
# QTBUG-63915
b2qt 64bit
diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST
deleted file mode 100644
index d5ee9650cd..0000000000
--- a/tests/auto/corelib/io/qstandardpaths/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-[testFindExecutable]
-# QTBUG-64404
-b2qt 64bit
diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
index 9fd7047405..44b1ce8dd8 100644
--- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
+++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro
@@ -5,3 +5,6 @@ INCLUDEPATH += ../../../../shared/
HEADERS += ../../../../shared/emulationdetector.h
SOURCES = tst_qstandardpaths.cpp
TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro
+
+# QTBUG-64404
+boot2qt: DEFINES+=SKIP_FINDEXECUTABLE
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 5cb130f631..1379c788d1 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -371,6 +371,12 @@ static inline QFileInfo findSh()
void tst_qstandardpaths::testFindExecutable_data()
{
+#ifdef SKIP_FINDEXECUTABLE
+ // Test needs to be skipped or Q_ASSERT below will cancel the test
+ // and report FAIL regardless of BLACKLIST contents
+ QSKIP("QTBUG-64404");
+#endif
+
QTest::addColumn<QString>("directory");
QTest::addColumn<QString>("needle");
QTest::addColumn<QString>("expected");
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 936cbd3894..68a92ebcc3 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6727,16 +6727,16 @@ void tst_QObject::connectWarnings()
r1.reset();
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter");
- connect(nullptr, &SubSender::signal1, &r1, &ReceiverObject::slot1);
+ connect(static_cast<const SenderObject *>(nullptr), &SubSender::signal1, &r1, &ReceiverObject::slot1);
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SubSender, Unknown): invalid null parameter");
- connect(&sub, &SubSender::signal1, nullptr, &ReceiverObject::slot1);
+ connect(&sub, &SubSender::signal1, static_cast<ReceiverObject *>(nullptr), &ReceiverObject::slot1);
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter");
- connect(nullptr, &SenderObject::signal1, &r1, &ReceiverObject::slot1);
+ connect(static_cast<const SenderObject *>(nullptr), &SenderObject::signal1, &r1, &ReceiverObject::slot1);
QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, Unknown): invalid null parameter");
- connect(&obj, &SenderObject::signal1, nullptr, &ReceiverObject::slot1);
+ connect(&obj, &SenderObject::signal1, static_cast<ReceiverObject *>(nullptr), &ReceiverObject::slot1);
}
struct QmlReceiver : public QtPrivate::QSlotObjectBase
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri
new file mode 100644
index 0000000000..ca4a0a07e9
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pri
@@ -0,0 +1,13 @@
+TEMPLATE = aux
+
+# Needs explicit load()ing due to aux template. Relies on QT being non-empty.
+load(qt)
+
+goodlib.target = good.$${QMAKE_APPLE_DEVICE_ARCHS}.dylib
+goodlib.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $<
+goodlib.depends += $$PWD/../fakeplugin.cpp
+
+all.depends += goodlib
+
+QMAKE_EXTRA_TARGETS += goodlib all
+QMAKE_CLEAN += $$goodlib.target
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
index 7f7caa7f76..795dd89895 100644
--- a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
@@ -1,64 +1,15 @@
-TEMPLATE = aux
-OTHER_FILES += \
- ppcconverter.pl \
- generate-bad.pl
+TEMPLATE = subdirs
-# Needs explicit load()ing due to aux template. Relies on QT being non-empty.
-load(qt)
-
-i386_d.target = good.i386.dylib
-i386_d.depends = EXPORT_VALID_ARCHS=i386
-i386.target = good.i386.dylib
-i386.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $<
-i386.depends += $$PWD/../fakeplugin.cpp
-
-x86_64_d.target = good.x86_64.dylib
-x86_64_d.depends = EXPORT_VALID_ARCHS=x86_64
-x86_64.target = good.x86_64.dylib
-x86_64.commands = $(CXX) $(CXXFLAGS) -shared -o $@ -I$(INCPATH) $<
-x86_64.depends += $$PWD/../fakeplugin.cpp
-
-# Current Mac OS X toolchains have no compiler for PPC anymore
-# So we fake it by converting an x86-64 binary to (little-endian!) PPC64
-ppc64.target = good.ppc64.dylib
-ppc64.commands = $$PWD/ppcconverter.pl $< $@
-ppc64.depends = x86_64 $$PWD/ppcconverter.pl
-
-# Generate a fat binary with three architectures
-fat_all.target = good.fat.all.dylib
-fat_all.commands = lipo -create -output $@ \
- -arch ppc64 $$ppc64.target \
- -arch i386 $$i386.target \
- -arch x86_64 $$x86_64.target
-fat_all.depends += i386 x86_64 ppc64
-
-fat_no_i386.target = good.fat.no-i386.dylib
-fat_no_i386.commands = lipo -create -output $@ -arch x86_64 $$x86_64.target -arch ppc64 $$ppc64.target
-fat_no_i386.depends += x86_64 ppc64
-
-fat_no_x86_64.target = good.fat.no-x86_64.dylib
-fat_no_x86_64.commands = lipo -create -output $@ -arch i386 $$i386.target -arch ppc64 $$ppc64.target
-fat_no_x86_64.depends += i386 ppc64
-
-fat_stub_i386.target = good.fat.stub-i386.dylib
-fat_stub_i386.commands = lipo -create -output $@ -arch ppc64 $$ppc64.target -arch_blank i386
-fat_stub_i386.depends += x86_64 ppc64
-
-fat_stub_x86_64.target = good.fat.stub-x86_64.dylib
-fat_stub_x86_64.commands = lipo -create -output $@ -arch ppc64 $$ppc64.target -arch_blank x86_64
-fat_stub_x86_64.depends += i386 ppc64
-
-bad.commands = $$PWD/generate-bad.pl
-bad.depends += $$PWD/generate-bad.pl
-
-MYTARGETS = $$fat_all.depends fat_all fat_no_x86_64 fat_no_i386 \
- fat_stub_i386 fat_stub_x86_64 bad
-all.depends += $$MYTARGETS
-QMAKE_EXTRA_TARGETS += i386_d x86_64_d $$MYTARGETS all
-
-QMAKE_CLEAN += $$i386.target $$x86_64.target $$ppc64.target $$fat_all.target \
- $$fat_no_i386.target $$fat_no_x86_64.target \
- $$fat_stub_i386.target $$fat_stub_x86_64.target \
- "bad*.dylib"
+SUBDIRS = \
+ machtest_i386.pro \
+ machtest_x86_64.pro \
+ machtest_ppc64.pro \
+ machtest_fat.pro
+machtest_fat-pro.depends = \
+ machtest_i386.pro \
+ machtest_x86_64.pro \
+ machtest_ppc64.pro
+machtest_ppc64-pro.depends = \
+ machtest_x86_64.pro
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro
new file mode 100644
index 0000000000..8daa343e2b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_fat.pro
@@ -0,0 +1,41 @@
+TEMPLATE = aux
+OTHER_FILES += generate-bad.pl
+
+# Needs explicit load()ing due to aux template. Relies on QT being non-empty.
+load(qt)
+
+# Generate a fat binary with three architectures
+fat_all.target = good.fat.all.dylib
+fat_all.commands = lipo -create -output $@ \
+ -arch ppc64 good.ppc64.dylib \
+ -arch i386 good.i386.dylib \
+ -arch x86_64 good.x86_64.dylib
+fat_all.depends += good.i386.dylib good.x86_64.dylib good.ppc64.dylib
+
+fat_no_i386.target = good.fat.no-i386.dylib
+fat_no_i386.commands = lipo -create -output $@ -arch x86_64 good.x86_64.dylib -arch ppc64 good.ppc64.dylib
+fat_no_i386.depends += good.x86_64.dylib good.ppc64.dylib
+
+fat_no_x86_64.target = good.fat.no-x86_64.dylib
+fat_no_x86_64.commands = lipo -create -output $@ -arch i386 good.i386.dylib -arch ppc64 good.ppc64.dylib
+fat_no_x86_64.depends += good.i386.dylib good.ppc64.dylib
+
+fat_stub_i386.target = good.fat.stub-i386.dylib
+fat_stub_i386.commands = lipo -create -output $@ -arch ppc64 good.ppc64.dylib -arch_blank i386
+fat_stub_i386.depends += good.x86_64.dylib good.ppc64.dylib
+
+fat_stub_x86_64.target = good.fat.stub-x86_64.dylib
+fat_stub_x86_64.commands = lipo -create -output $@ -arch ppc64 good.ppc64.dylib -arch_blank x86_64
+fat_stub_x86_64.depends += good.i386.dylib good.ppc64.dylib
+
+bad.commands = $$PWD/generate-bad.pl
+bad.depends += $$PWD/generate-bad.pl
+
+MYTARGETS = $$fat_all.depends fat_all fat_no_x86_64 fat_no_i386 \
+ fat_stub_i386 fat_stub_x86_64 bad
+all.depends += $$MYTARGETS
+QMAKE_EXTRA_TARGETS += $$MYTARGETS all
+
+QMAKE_CLEAN += $$fat_all.target $$fat_no_i386.target $$fat_no_x86_64.target \
+ $$fat_stub_i386.target $$fat_stub_x86_64.target \
+ "bad*.dylib"
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro
new file mode 100644
index 0000000000..bfb2e0930c
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_i386.pro
@@ -0,0 +1,3 @@
+QMAKE_APPLE_DEVICE_ARCHS = i386
+include(machtest.pri)
+
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro
new file mode 100644
index 0000000000..a73f97ccc6
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_ppc64.pro
@@ -0,0 +1,9 @@
+QMAKE_APPLE_DEVICE_ARCHS = ppc64
+include(machtest.pri)
+
+OTHER_FILES += ppcconverter.pl
+
+# Current macOS toolchains have no compiler for PPC anymore
+# So we fake it by converting an x86-64 binary to (little-endian!) PPC64
+goodlib.commands = $$PWD/ppcconverter.pl $< $@
+goodlib.depends = good.x86_64.dylib $$PWD/ppcconverter.pl
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro
new file mode 100644
index 0000000000..9dbae5c4ee
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/machtest_x86_64.pro
@@ -0,0 +1,2 @@
+QMAKE_APPLE_DEVICE_ARCHS = x86_64
+include(machtest.pri)
diff --git a/tests/auto/corelib/serialization/qtextstream/test/test.pro b/tests/auto/corelib/serialization/qtextstream/test/test.pro
index 3dcfa0b414..0f289a5ce1 100644
--- a/tests/auto/corelib/serialization/qtextstream/test/test.pro
+++ b/tests/auto/corelib/serialization/qtextstream/test/test.pro
@@ -3,6 +3,8 @@ TARGET = ../tst_qtextstream
QT = core network testlib
SOURCES = ../tst_qtextstream.cpp
RESOURCES += ../qtextstream.qrc
+INCLUDEPATH += ../../../../../shared/
+HEADERS += ../../../../../shared/emulationdetector.h
win32 {
CONFIG(debug, debug|release) {
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
index 1c1631760b..8bb35554c8 100644
--- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
@@ -44,7 +44,7 @@
# include <QProcess>
#endif
#include "../../../network-settings.h"
-
+#include "emulationdetector.h"
QT_BEGIN_NAMESPACE
template<> struct QMetaTypeId<QIODevice::OpenModeFlag>
@@ -1460,6 +1460,9 @@ void tst_QTextStream::pos2()
// ------------------------------------------------------------------------------
void tst_QTextStream::pos3LargeFile()
{
+ if (EmulationDetector::isRunningArmOnX86())
+ QSKIP("Running QTextStream::pos() in tight loop is too slow on emulator");
+
{
QFile file(testFileName);
file.open(QIODevice::WriteOnly | QIODevice::Text);
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index ff36beadcb..9bb0c6811d 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -84,6 +84,8 @@ private slots:
void matchingLocales();
void stringToDouble_data();
void stringToDouble();
+ void stringToFloat_data();
+ void stringToFloat();
void doubleToString_data();
void doubleToString();
void strtod_data();
@@ -160,6 +162,17 @@ private:
QString m_sysapp;
QStringList cleanEnv;
bool europeanTimeZone;
+ void toReal_data();
+
+ class TransientLocale
+ {
+ const int m_category;
+ const char *const m_prior;
+ public:
+ TransientLocale(int category, const char *locale)
+ : m_category(category), m_prior(setlocale(category, locale)) {}
+ ~TransientLocale() { setlocale(m_category, m_prior); }
+ };
};
tst_QLocale::tst_QLocale()
@@ -741,7 +754,7 @@ void tst_QLocale::unixLocaleName()
QCOMPARE(locale.name(), expect);
}
-void tst_QLocale::stringToDouble_data()
+void tst_QLocale::toReal_data()
{
QTest::addColumn<QString>("locale_name");
QTest::addColumn<QString>("num_str");
@@ -754,6 +767,8 @@ void tst_QLocale::stringToDouble_data()
QTest::newRow("C 1.234e-10") << QString("C") << QString("1.234e-10") << true << 1.234e-10;
QTest::newRow("C 1.234E10") << QString("C") << QString("1.234E10") << true << 1.234e10;
QTest::newRow("C 1e10") << QString("C") << QString("1e10") << true << 1.0e10;
+ QTest::newRow("C 1e310") << QString("C") << QString("1e310") << false << std::numeric_limits<double>::infinity();
+ QTest::newRow("C 1E310") << QString("C") << QString("1E310") << false << std::numeric_limits<double>::infinity();
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
QTest::newRow("C 1") << QString("C") << QString(" 1") << true << 1.0;
QTest::newRow("C 1 ") << QString("C") << QString("1 ") << true << 1.0;
@@ -863,9 +878,35 @@ void tst_QLocale::stringToDouble_data()
QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0;
}
+void tst_QLocale::stringToDouble_data()
+{
+ toReal_data();
+ if (std::numeric_limits<double>::has_infinity) {
+ double huge = std::numeric_limits<double>::infinity();
+ QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge;
+ QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge;
+ QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge;
+ // Overflow:
+ QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge;
+ QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge;
+ }
+ if (std::numeric_limits<double>::has_quiet_NaN)
+ QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << std::numeric_limits<double>::quiet_NaN();
+
+ // In range (but outside float's range):
+ QTest::newRow("C big") << QString("C") << QString("3.5e38") << true << 3.5e38;
+ QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << true << -3.5e38;
+ QTest::newRow("C small") << QString("C") << QString("1e-45") << true << 1e-45;
+ QTest::newRow("C -small") << QString("C") << QString("-1e-45") << true << -1e-45;
+
+ // Underflow:
+ QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.;
+ QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.;
+}
+
void tst_QLocale::stringToDouble()
{
-#define MY_DOUBLE_EPSILON (2.22045e-16)
+#define MY_DOUBLE_EPSILON (2.22045e-16) // 1/2^{52}; double has a 53-bit mantissa
QFETCH(QString, locale_name);
QFETCH(QString, num_str);
@@ -880,27 +921,107 @@ void tst_QLocale::stringToDouble()
double d = locale.toDouble(num_str, &ok);
QCOMPARE(ok, good);
- char *currentLocale = setlocale(LC_ALL, "de_DE");
- QCOMPARE(locale.toDouble(num_str, &ok), d); // make sure result is independent of locale
- QCOMPARE(ok, good);
- setlocale(LC_ALL, currentLocale);
+ {
+ // Make sure result is independent of locale:
+ TransientLocale ignoreme(LC_ALL, "ar_SA");
+ QCOMPARE(locale.toDouble(num_str, &ok), d);
+ QCOMPARE(ok, good);
+ }
- if (ok) {
- double diff = d - num;
- if (diff < 0)
- diff = -diff;
- QVERIFY(diff <= MY_DOUBLE_EPSILON);
+ if (ok || std::isinf(num)) {
+ // First use fuzzy-compare, then a more precise check:
+ QCOMPARE(d, num);
+ if (std::isfinite(num)) {
+ double diff = d > num ? d - num : num - d;
+ QVERIFY(diff <= MY_DOUBLE_EPSILON);
+ }
}
d = locale.toDouble(num_strRef, &ok);
QCOMPARE(ok, good);
- if (ok) {
- double diff = d - num;
- if (diff < 0)
- diff = -diff;
- QVERIFY(diff <= MY_DOUBLE_EPSILON);
+ if (ok || std::isinf(num)) {
+ QCOMPARE(d, num);
+ if (std::isfinite(num)) {
+ double diff = d > num ? d - num : num - d;
+ QVERIFY(diff <= MY_DOUBLE_EPSILON);
+ }
+ }
+#undef MY_DOUBLE_EPSILON
+}
+
+void tst_QLocale::stringToFloat_data()
+{
+ toReal_data();
+ if (std::numeric_limits<float>::has_infinity) {
+ double huge = std::numeric_limits<float>::infinity();
+ QTest::newRow("C inf") << QString("C") << QString("inf") << true << huge;
+ QTest::newRow("C +inf") << QString("C") << QString("+inf") << true << +huge;
+ QTest::newRow("C -inf") << QString("C") << QString("-inf") << true << -huge;
+ // Overflow float, but not double:
+ QTest::newRow("C big") << QString("C") << QString("3.5e38") << false << huge;
+ QTest::newRow("C -big") << QString("C") << QString("-3.5e38") << false << -huge;
+ // Overflow double, too:
+ QTest::newRow("C huge") << QString("C") << QString("2e308") << false << huge;
+ QTest::newRow("C -huge") << QString("C") << QString("-2e308") << false << -huge;
+ }
+ if (std::numeric_limits<float>::has_quiet_NaN)
+ QTest::newRow("C qnan") << QString("C") << QString("NaN") << true << double(std::numeric_limits<float>::quiet_NaN());
+
+ // Underflow float, but not double:
+ QTest::newRow("C small") << QString("C") << QString("1e-45") << false << 0.;
+ QTest::newRow("C -small") << QString("C") << QString("-1e-45") << false << 0.;
+
+ // Underflow double, too:
+ QTest::newRow("C tiny") << QString("C") << QString("2e-324") << false << 0.;
+ QTest::newRow("C -tiny") << QString("C") << QString("-2e-324") << false << 0.;
+}
+
+void tst_QLocale::stringToFloat()
+{
+#define MY_FLOAT_EPSILON (2.384e-7) // 1/2^{22}; float has a 23-bit mantissa
+
+ QFETCH(QString, locale_name);
+ QFETCH(QString, num_str);
+ QFETCH(bool, good);
+ QFETCH(double, num);
+ QStringRef num_strRef = num_str.leftRef(-1);
+ float fnum = num;
+
+ QLocale locale(locale_name);
+ QCOMPARE(locale.name(), locale_name);
+
+ bool ok;
+ float f = locale.toFloat(num_str, &ok);
+ QCOMPARE(ok, good);
+
+ {
+ // Make sure result is independent of locale:
+ TransientLocale ignoreme(LC_ALL, "ar_SA");
+ QCOMPARE(locale.toFloat(num_str, &ok), f);
+ QCOMPARE(ok, good);
+ }
+
+ if (ok || std::isinf(fnum)) {
+ // First use fuzzy-compare, then a more precise check:
+ QCOMPARE(f, fnum);
+ if (std::isfinite(fnum)) {
+ float diff = f > fnum ? f - fnum : fnum - f;
+ QVERIFY(diff <= MY_FLOAT_EPSILON);
+ }
+ }
+
+ f = locale.toFloat(num_strRef, &ok);
+ QCOMPARE(ok, good);
+
+ if (ok || std::isinf(fnum)) {
+ QCOMPARE(f, fnum);
+ if (std::isfinite(fnum)) {
+ float diff = f > fnum ? f - fnum : fnum - f;
+ QVERIFY(diff <= MY_FLOAT_EPSILON);
+ }
}
+#undef MY_FLOAT_EPSILON
}
void tst_QLocale::doubleToString_data()
@@ -1013,9 +1134,8 @@ void tst_QLocale::doubleToString()
const QLocale locale(locale_name);
QCOMPARE(locale.toString(num, mode, precision), num_str);
- char *currentLocale = setlocale(LC_ALL, "de_DE");
+ TransientLocale ignoreme(LC_ALL, "de_DE");
QCOMPARE(locale.toString(num, mode, precision), num_str);
- setlocale(LC_ALL, currentLocale);
}
void tst_QLocale::strtod_data()
diff --git a/tests/auto/gui/text/qfontdatabase/testdata.qrc b/tests/auto/gui/text/qfontdatabase/testdata.qrc
index 81a0b5b0bf..224e845601 100644
--- a/tests/auto/gui/text/qfontdatabase/testdata.qrc
+++ b/tests/auto/gui/text/qfontdatabase/testdata.qrc
@@ -3,5 +3,6 @@
<file>LED_REAL.TTF</file>
<file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
<file alias="testfont_condensed.ttf">../../../shared/resources/testfont_condensed.ttf</file>
+ <file alias="testfont_italic.ttf">../../../shared/resources/testfont_italic.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index da2f100c0b..68664cdd2f 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -61,6 +61,8 @@ private slots:
void addAppFont_data();
void addAppFont();
+ void addTwoAppFontsFromFamily();
+
void aliases();
void fallbackFonts();
@@ -75,6 +77,7 @@ private:
QString m_ledFont;
QString m_testFont;
QString m_testFontCondensed;
+ QString m_testFontItalic;
};
tst_QFontDatabase::tst_QFontDatabase()
@@ -86,9 +89,11 @@ void tst_QFontDatabase::initTestCase()
m_ledFont = QFINDTESTDATA("LED_REAL.TTF");
m_testFont = QFINDTESTDATA("testfont.ttf");
m_testFontCondensed = QFINDTESTDATA("testfont_condensed.ttf");
+ m_testFontItalic = QFINDTESTDATA("testfont_italic.ttf");
QVERIFY(!m_ledFont.isEmpty());
QVERIFY(!m_testFont.isEmpty());
QVERIFY(!m_testFontCondensed.isEmpty());
+ QVERIFY(!m_testFontItalic.isEmpty());
}
void tst_QFontDatabase::styles_data()
@@ -259,6 +264,30 @@ void tst_QFontDatabase::addAppFont()
QCOMPARE(db.families(), oldFamilies);
}
+void tst_QFontDatabase::addTwoAppFontsFromFamily()
+{
+ int regularId = QFontDatabase::addApplicationFont(m_testFont);
+ if (regularId == -1)
+ QSKIP("Skip the test since app fonts are not supported on this system");
+
+ int italicId = QFontDatabase::addApplicationFont(m_testFontItalic);
+ QVERIFY(italicId != -1);
+
+ QVERIFY(!QFontDatabase::applicationFontFamilies(regularId).isEmpty());
+ QVERIFY(!QFontDatabase::applicationFontFamilies(italicId).isEmpty());
+
+ QString regularFontName = QFontDatabase::applicationFontFamilies(regularId).first();
+ QString italicFontName = QFontDatabase::applicationFontFamilies(italicId).first();
+ QCOMPARE(regularFontName, italicFontName);
+
+ QFont italicFont = QFontDatabase().font(italicFontName,
+ QString::fromLatin1("Italic"), 14);
+ QVERIFY(italicFont.italic());
+
+ QFontDatabase::removeApplicationFont(regularId);
+ QFontDatabase::removeApplicationFont(italicId);
+}
+
void tst_QFontDatabase::aliases()
{
QFontDatabase db;
diff --git a/tests/auto/network/access/http2/http2.pro b/tests/auto/network/access/http2/http2.pro
index 62b685e556..646ea117f7 100644
--- a/tests/auto/network/access/http2/http2.pro
+++ b/tests/auto/network/access/http2/http2.pro
@@ -2,7 +2,8 @@ QT = core core-private network network-private testlib
CONFIG += testcase parallel_test c++11
TARGET = tst_http2
-HEADERS += http2srv.h
+INCLUDEPATH += ../../../../shared/
+HEADERS += http2srv.h ../../../../shared/emulationdetector.h
SOURCES += tst_http2.cpp http2srv.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index 49daedf32c..235b78c34a 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -48,6 +48,8 @@
#include <cstdlib>
#include <string>
+#include "emulationdetector.h"
+
#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
// HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version.
const bool clearTextHTTP2 = false;
@@ -288,6 +290,9 @@ void tst_Http2::flowControlServerSide()
// to let all replies finish without any error.
using namespace Http2;
+ if (EmulationDetector::isRunningArmOnX86())
+ QSKIP("Test is too slow to run on emulator");
+
clearHTTP2State();
serverPort = 0;
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 263a475435..c473230246 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -2429,7 +2429,17 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString())));
while (!serverProcess.canReadLine())
QVERIFY(serverProcess.waitForReadyRead(10000));
- QCOMPARE(serverProcess.readLine().data(), QByteArray(server.toLatin1() + "\n").data());
+
+ QByteArray line = serverProcess.readLine();
+
+ // Ignore following print, happens on Qemu:
+ if (line == "getsockopt level=41 optname=26 not yet supported\n") {
+ while (!serverProcess.canReadLine())
+ QVERIFY(serverProcess.waitForReadyRead(10000));
+ line = serverProcess.readLine();
+ }
+
+ QCOMPARE(line.data(), QByteArray(server.toLatin1() + "\n").data());
// Start client
QProcess clientProcess;
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index 65a688ec40..8aa3a035e3 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -36,6 +36,7 @@
#include <qtextlayout.h>
#include <qdebug.h>
#include <QStaticText>
+#include <QTextDocument>
#include <private/qimage_p.h>
#ifndef QT_NO_OPENGL
@@ -441,6 +442,10 @@ void PaintCommands::staticInit()
"^drawStaticText\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$",
"drawStaticText <x> <y> <text>",
"drawStaticText 10 10 \"my text\"");
+ DECL_PAINTCOMMAND("drawTextDocument", command_drawTextDocument,
+ "^drawTextDocument\\s+(-?\\w*)\\s+(-?\\w*)\\s+\"(.*)\"$",
+ "drawTextDocument <x> <y> <html>",
+ "drawTextDocument 10 10 \"html\"");
DECL_PAINTCOMMAND("drawTiledPixmap", command_drawTiledPixmap,
"^drawTiledPixmap\\s+([\\w.:\\/]*)"
"\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w*)\\s*(-?\\w*)"
@@ -1295,6 +1300,29 @@ void PaintCommands::command_drawStaticText(QRegularExpressionMatch re)
m_painter->drawStaticText(x, y, QStaticText(txt));
}
+void PaintCommands::command_drawTextDocument(QRegularExpressionMatch re)
+{
+ if (!m_shouldDrawText)
+ return;
+ QStringList caps = re.capturedTexts();
+ int x = convertToInt(caps.at(1));
+ int y = convertToInt(caps.at(2));
+ QString txt = caps.at(3);
+
+ if (m_verboseMode)
+ printf(" -(lance) drawTextDocument(%d, %d, %s)\n", x, y, qPrintable(txt));
+
+ QTextDocument doc;
+ doc.setBaseUrl(QUrl::fromLocalFile(QDir::currentPath() + QLatin1String("/")));
+ doc.setHtml(txt);
+
+ m_painter->save();
+ m_painter->translate(x, y);
+ doc.drawContents(m_painter);
+ m_painter->restore();
+}
+
+
/***************************************************************************************************/
void PaintCommands::command_noop(QRegularExpressionMatch)
{
diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h
index 83e3bbc11c..79bdab634a 100644
--- a/tests/auto/other/lancelot/paintcommands.h
+++ b/tests/auto/other/lancelot/paintcommands.h
@@ -198,6 +198,7 @@ private:
void command_drawRoundRect(QRegularExpressionMatch re);
void command_drawText(QRegularExpressionMatch re);
void command_drawStaticText(QRegularExpressionMatch re);
+ void command_drawTextDocument(QRegularExpressionMatch re);
void command_drawTiledPixmap(QRegularExpressionMatch re);
void command_path_addEllipse(QRegularExpressionMatch re);
void command_path_addPolygon(QRegularExpressionMatch re);
diff --git a/tests/auto/other/lancelot/scripts/richtext.qps b/tests/auto/other/lancelot/scripts/richtext.qps
new file mode 100644
index 0000000000..787c97421b
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/richtext.qps
@@ -0,0 +1,9 @@
+drawTextDocument 10 10 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 valign=bottom src=:/images/border.png /><span style='font-size: 100px'>Xy</span>"
+drawTextDocument 10 210 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+drawTextDocument 310 210 "<img height=10 width=10 align=top src=:/images/border.png /><img height=50 width=50 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+drawTextDocument 10 310 "<img height=50 width=50 align=top src=:/images/border.png /><img height=50 width=50 valign=bottom src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+
+drawTextDocument 10 410 "<img height=10 width=10 align=top src=:/images/border.png /><img height=50 width=50 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+drawTextDocument 10 510 "<img height=10 width=10 valign=bottom src=:/images/border.png /><img height=50 width=50 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+drawTextDocument 310 410 "<img height=50 width=50 align=top src=:/images/border.png /><img height=10 width=10 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
+drawTextDocument 310 510 "<img height=50 width=50 valign=bottom src=:/images/border.png /><img height=10 width=10 src=:/images/border.png /><span style='font-size: 25px'>Xy</span>"
diff --git a/tests/auto/other/qobjectrace/qobjectrace.pro b/tests/auto/other/qobjectrace/qobjectrace.pro
index 94e7928585..6536810534 100644
--- a/tests/auto/other/qobjectrace/qobjectrace.pro
+++ b/tests/auto/other/qobjectrace/qobjectrace.pro
@@ -2,3 +2,6 @@ CONFIG += testcase
SOURCES += tst_qobjectrace.cpp
QT = core testlib
+INCLUDEPATH += ../../../shared/
+HEADERS += ../../../shared/emulationdetector.h
+
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
index e6eb51500b..0d656e223c 100644
--- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
@@ -30,6 +30,7 @@
#include <QtCore>
#include <QtTest/QtTest>
+#include "emulationdetector.h"
enum { OneMinute = 60 * 1000,
TwoMinutes = OneMinute * 2 };
@@ -256,6 +257,9 @@ public:
void tst_QObjectRace::destroyRace()
{
+ if (EmulationDetector::isRunningArmOnX86())
+ QSKIP("Test is too slow to run on emulator");
+
enum { ThreadCount = 10, ObjectCountPerThread = 2777,
ObjectCount = ThreadCount * ObjectCountPerThread };
diff --git a/tests/auto/shared/resources/testfont_italic.ttf b/tests/auto/shared/resources/testfont_italic.ttf
new file mode 100644
index 0000000000..0a01f883f4
--- /dev/null
+++ b/tests/auto/shared/resources/testfont_italic.ttf
Binary files differ
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 008cce6218..f460ca3963 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -676,6 +676,9 @@ static inline QByteArray msgProcessError(const QString &binary, const QStringLis
void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes)
{
+ if (EmulationDetector::isRunningArmOnX86() && (subdir == "crashes"))
+ QSKIP("Skipping \"crashes\" due to QTBUG-71915");
+
#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
if (arguments.contains("-callgrind")) {
QProcess checkProcess;
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index bfef9d2ac4..8f1f8590cb 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -2085,7 +2085,8 @@ void tst_QStyleSheetStyle::highdpiImages()
QFETCH(QColor, color);
QWidget w;
- QScreen *screen = QGuiApplication::screenAt(w.pos());
+ QScreen *screen = QGuiApplication::primaryScreen();
+ w.move(screen->availableGeometry().topLeft());
QHighDpiScaling::setScreenFactor(screen, screenFactor);
w.setStyleSheet("QWidget { background-image: url(\":/images/testimage.png\"); }");
w.show();
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index 43063881b2..fac13c7074 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -347,9 +347,6 @@ void tst_QScroller::scrollerProperties()
void tst_QScroller::scrollTo()
{
-#ifdef Q_OS_MAC
- QSKIP("Flakey test - QTBUG-29950");
-#endif
{
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF( 0, 0, 1000, 1000 );
@@ -376,9 +373,6 @@ void tst_QScroller::scrollTo()
void tst_QScroller::scroll()
{
-#ifdef Q_OS_MAC
- QSKIP("Flakey test - QTBUG-30133");
-#endif
#ifndef QT_NO_GESTURES
// -- good case. normal scroll
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
@@ -419,9 +413,6 @@ void tst_QScroller::scroll()
void tst_QScroller::overshoot()
{
-#ifdef Q_OS_MAC
- QSKIP("Flakey test - QTBUG-29950");
-#endif
#ifndef QT_NO_GESTURES
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF(0, 0, 1000, 1000);
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 943fb997cd..5b4761ba87 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -1671,6 +1671,13 @@ void tst_QComboBox::setCustomModelAndView()
QTRY_VERIFY(combo.view()->isVisible());
const QRect subItemRect = view->visualRect(model->indexFromItem(subItem));
QWidget *window = view->window();
+
+ // QComboBox sometimes ignores the mouse click event for doubleClickInterval
+ // depending on which tests have been run previously. On arm this happens
+ // more often than on x86. Search for maybeIgnoreMouseButtonRelease to see
+ // why this happens.
+ QTest::qWait(QApplication::doubleClickInterval());
+
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center()));
#ifdef Q_OS_WINRT
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
@@ -3421,6 +3428,11 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
model->setFilterFixedString("foobar1");
completer->setModel(model);
+ if (QGuiApplication::platformName() == "offscreen") {
+ QWARN("Offscreen platform requires explicit activateWindow()");
+ cbox.activateWindow();
+ }
+
QApplication::setActiveWindow(&cbox);
QVERIFY(QTest::qWaitForWindowActive(&cbox));
diff --git a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp
index e6e689336a..657a1ea55c 100644
--- a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp
+++ b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp
@@ -32,6 +32,8 @@
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qfocusframe.h>
+#include <qtableview.h>
+#include <qstandarditemmodel.h>
class tst_QFocusFrame : public QObject
{
@@ -43,6 +45,7 @@ public:
private slots:
void getSetCheck();
+ void focusFrameInsideScrollview();
};
tst_QFocusFrame::tst_QFocusFrame()
@@ -68,5 +71,41 @@ void tst_QFocusFrame::getSetCheck()
delete obj1;
}
+void tst_QFocusFrame::focusFrameInsideScrollview()
+{
+ // Make sure that the focus frame follows the widget, even
+ // if the widget is inside a QAbstractItemView. A QAbstractItemView will scroll
+ // all the children, including the focus frame, when it scrolls, which
+ // is why special considerations are taken inside the focus frame to
+ // prevent the frame to scroll away from the widget it tracks.
+
+ if (qApp->style()->objectName() != QLatin1String("macintosh"))
+ QSKIP("This test is only valid when using a style that has a focus frame");
+
+ QWidget window;
+ window.setGeometry(100, 100, 500, 500);
+
+ QTableView tableView(&window);
+ tableView.resize(window.size());
+ QStandardItemModel *itemModel = new QStandardItemModel();
+ for (int i = 0; i < 50; ++i)
+ itemModel->appendRow(new QStandardItem("Value"));
+ tableView.setModel(itemModel);
+ tableView.edit(itemModel->index(8, 0));
+
+ window.show();
+ QFocusFrame *focusFrame = nullptr;
+ QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
+ const QPoint initialOffset = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint());
+
+ tableView.scrollTo(itemModel->index(40, 0));
+ QPoint offsetAfterScroll = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint());
+ QCOMPARE(offsetAfterScroll, initialOffset);
+
+ tableView.scrollTo(itemModel->index(0, 0));
+ offsetAfterScroll = focusFrame->widget()->mapToGlobal(QPoint()) - focusFrame->mapToGlobal(QPoint());
+ QCOMPARE(offsetAfterScroll, initialOffset);
+}
+
QTEST_MAIN(tst_QFocusFrame)
#include "tst_qfocusframe.moc"