From dde8d5e3a006c87b7a3f18733ba255d6354fcd37 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 15 Oct 2015 14:47:18 +0200 Subject: QTextStream: add missing op<<(QStringRef) It simply is missing. We could wait for QStringView to come around, but I need this function in uic _now_, so let's add it. [ChangeLog][QtCore][QTextStream] Can now stream QStringRef without converting to a QString first. Change-Id: Idd178e0ba8a89c025f4533d46de912cbdb3883d5 Reviewed-by: Lars Knoll --- tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index ecec97f009..6e58642eb6 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -163,6 +163,7 @@ private slots: void string_write_operator_ToDevice_data(); void string_write_operator_ToDevice(); void latin1String_write_operator_ToDevice(); + void stringref_write_operator_ToDevice(); // other void skipWhiteSpace_data(); @@ -2554,6 +2555,22 @@ void tst_QTextStream::latin1String_write_operator_ToDevice() QCOMPARE(buf.buffer().constData(), "No explicit lengthExplicit length"); } +void tst_QTextStream::stringref_write_operator_ToDevice() +{ + QBuffer buf; + buf.open(QBuffer::WriteOnly); + QTextStream stream(&buf); + stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); + stream.setAutoDetectUnicode(true); + + const QString expected = "No explicit lengthExplicit length"; + + stream << expected.leftRef(18); + stream << expected.midRef(18); + stream.flush(); + QCOMPARE(buf.buffer().constData(), "No explicit lengthExplicit length"); +} + // ------------------------------------------------------------------------------ void tst_QTextStream::useCase1() { -- cgit v1.2.3 From 1901adbab796e27e7ed862e850a2171ffc4dde90 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 12 Oct 2015 10:41:21 +0200 Subject: Split two error cases so they get reported distinctly. If a macro is used with too few parameters, complaining about its definition using '#' followed by something other than a macro parameter name is apt to be confusing - reading the definition will reveal that the name in fact is a macro parameter after all. The reader needs attention directed to the invocation, not the definition. Split the test in two: one to test the prior error message does in fact get produced for an invalid macro definition, the other to test the invalid invocation case. Task-number: QTBUG-46210 Change-Id: Ie177a56d346e553bf9d67e2008a4352633afa1ae Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/tools/moc/tst_moc.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index fa1b68b4f9..4fa98b6ecb 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1883,12 +1883,19 @@ void tst_Moc::warnings_data() << QString() << QString("standard input:5: Error: Class declaration lacks Q_OBJECT macro."); - QTest::newRow("QTBUG-46210: crash on invalid macro") - << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45);") + QTest::newRow("Invalid macro definition") + << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45, 42, 39);") << QStringList() << 1 << QString("IGNORE_ALL_STDOUT") << QString(":2: Error: '#' is not followed by a macro parameter"); + + QTest::newRow("QTBUG-46210: crash on invalid macro invocation") + << QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c\n Foo(45);") + << QStringList() + << 1 + << QString("IGNORE_ALL_STDOUT") + << QString(":2: Error: Macro invoked with too few parameters for a use of '#'"); } void tst_Moc::warnings() -- cgit v1.2.3 From 9d1fab424e38d0ed40677926c0a434272ad41320 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Jul 2015 14:35:03 -0700 Subject: Make the C++11 atomic support the default, if available Change-Id: Ib056b47dde3341ef9a52ffff13ef1647ccd607b1 Reviewed-by: Lars Knoll --- .../thread/qatomicinteger/cxx11/char/char.pro | 1 - .../qatomicinteger/cxx11/char16_t/char16_t.pro | 1 - .../qatomicinteger/cxx11/char32_t/char32_t.pro | 1 - .../thread/qatomicinteger/cxx11/int/int.pro | 1 - .../thread/qatomicinteger/cxx11/long/long.pro | 1 - .../qatomicinteger/cxx11/qlonglong/qlonglong.pro | 1 - .../qatomicinteger/cxx11/qptrdiff/qptrdiff.pro | 1 - .../qatomicinteger/cxx11/quintptr/quintptr.pro | 1 - .../qatomicinteger/cxx11/qulonglong/qulonglong.pro | 1 - .../thread/qatomicinteger/cxx11/schar/schar.pro | 1 - .../thread/qatomicinteger/cxx11/short/short.pro | 1 - .../thread/qatomicinteger/cxx11/uchar/uchar.pro | 1 - .../thread/qatomicinteger/cxx11/uint/uint.pro | 1 - .../thread/qatomicinteger/cxx11/ulong/ulong.pro | 1 - .../thread/qatomicinteger/cxx11/ushort/ushort.pro | 1 - .../qatomicinteger/cxx11/wchar_t/wchar_t.pro | 1 - .../thread/qatomicinteger/no-cxx11/char/char.pro | 1 + .../qatomicinteger/no-cxx11/char16_t/char16_t.pro | 1 + .../qatomicinteger/no-cxx11/char32_t/char32_t.pro | 1 + .../thread/qatomicinteger/no-cxx11/int/int.pro | 1 + .../thread/qatomicinteger/no-cxx11/long/long.pro | 1 + .../no-cxx11/qlonglong/qlonglong.pro | 1 + .../qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro | 1 + .../qatomicinteger/no-cxx11/quintptr/quintptr.pro | 1 + .../no-cxx11/qulonglong/qulonglong.pro | 1 + .../thread/qatomicinteger/no-cxx11/schar/schar.pro | 1 + .../thread/qatomicinteger/no-cxx11/short/short.pro | 1 + .../thread/qatomicinteger/no-cxx11/uchar/uchar.pro | 1 + .../thread/qatomicinteger/no-cxx11/uint/uint.pro | 1 + .../thread/qatomicinteger/no-cxx11/ulong/ulong.pro | 1 + .../qatomicinteger/no-cxx11/ushort/ushort.pro | 1 + .../qatomicinteger/no-cxx11/wchar_t/wchar_t.pro | 1 + .../thread/qatomicinteger/qatomicinteger.pri | 6 ++-- .../thread/qatomicinteger/qatomicinteger.pro | 32 +++++++++++----------- 34 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro delete mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro (limited to 'tests') diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri index d9ebe64d5b..e80e71f238 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri @@ -3,9 +3,9 @@ TYPE = $$basename(_PRO_FILE_PWD_) dn = $$dirname(_PRO_FILE_PWD_) FORCE = $$basename(dn) -equals(FORCE, cxx11) { - suffix = Cxx11_$$TYPE - DEFINES += QT_ATOMIC_FORCE_CXX11 +equals(FORCE, no-cxx11) { + suffix = NoCxx11_$$TYPE + DEFINES += QT_ATOMIC_FORCE_NO_CXX11 } else: equals(FORCE, gcc) { suffix = Gcc_$$TYPE DEFINES += QT_ATOMIC_FORCE_GCC diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro index 58e5b157bd..9d929e649e 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro @@ -19,22 +19,22 @@ SUBDIRS=\ contains(QT_CONFIG, c++11)|msvc: SUBDIRS +=\ - cxx11/char \ - cxx11/char16_t \ - cxx11/char32_t \ - cxx11/int \ - cxx11/long \ - cxx11/qlonglong \ - cxx11/qptrdiff \ - cxx11/quintptr \ - cxx11/qulonglong \ - cxx11/schar \ - cxx11/short \ - cxx11/uchar \ - cxx11/uint \ - cxx11/ulong \ - cxx11/ushort \ - cxx11/wchar_t \ + no-cxx11/char \ + no-cxx11/char16_t \ + no-cxx11/char32_t \ + no-cxx11/int \ + no-cxx11/long \ + no-cxx11/qlonglong \ + no-cxx11/qptrdiff \ + no-cxx11/quintptr \ + no-cxx11/qulonglong \ + no-cxx11/schar \ + no-cxx11/short \ + no-cxx11/uchar \ + no-cxx11/uint \ + no-cxx11/ulong \ + no-cxx11/ushort \ + no-cxx11/wchar_t \ # The GCC-style atomics only support 32-bit and pointer-sized but add -- cgit v1.2.3 From 068a545339a3ec14187e6b9b5ea05c6ffbda05a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 2 Oct 2015 23:48:17 +0200 Subject: Add support for "@3x" image loading. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement as generic "@Nx" support in an exported qt_findAtNxFile function. 3x devices now get one extra file existence test in cases where @3x versions are not present. 1x devices are still on the fast path where there are no extra file system accesses. Add an @3x image to the highdpi manual test. Change-Id: I4ce3fc245ada01ea410abe1443ceb1e3abf7c17f Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- tests/manual/highdpi/highdpi.qrc | 1 + tests/manual/highdpi/qticon16@3x.png | Bin 0 -> 5307 bytes 2 files changed, 1 insertion(+) create mode 100644 tests/manual/highdpi/qticon16@3x.png (limited to 'tests') diff --git a/tests/manual/highdpi/highdpi.qrc b/tests/manual/highdpi/highdpi.qrc index 10efac44fa..0e33ed33d7 100644 --- a/tests/manual/highdpi/highdpi.qrc +++ b/tests/manual/highdpi/highdpi.qrc @@ -2,6 +2,7 @@ qticon16.png qticon16@2x.png + qticon16@3x.png qticon32.png qticon32@2x.png qticon64.png diff --git a/tests/manual/highdpi/qticon16@3x.png b/tests/manual/highdpi/qticon16@3x.png new file mode 100644 index 0000000000..de92658241 Binary files /dev/null and b/tests/manual/highdpi/qticon16@3x.png differ -- cgit v1.2.3 From 3695285fde904935fc2e88010dac171144e8677a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 18 Mar 2015 15:12:11 +0100 Subject: The C locale should omit group separators by default Numbers formatted in the C locale should not use group separators by default. [ChangeLog][QtCore][QLocale] The C locale does not use group separators when formatting numbers any more. Task-number: QTBUG-4044 Task-number: QTBUG-3068 Change-Id: Ia647a72efc11fecd66d22f9253562b1d4ef58168 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 21 +++++++++++---------- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 3 ++- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 11b6922278..0466ced10a 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -902,6 +902,7 @@ void tst_QLocale::long_long_conversion() void tst_QLocale::long_long_conversion_extra() { QLocale l(QLocale::C); + l.setNumberOptions(0); QCOMPARE(l.toString((qlonglong)1), QString("1")); QCOMPARE(l.toString((qlonglong)12), QString("12")); QCOMPARE(l.toString((qlonglong)123), QString("123")); @@ -1613,20 +1614,20 @@ void tst_QLocale::numberOptions() bool ok; QLocale locale(QLocale::C); - QCOMPARE(locale.numberOptions(), 0); - QCOMPARE(locale.toInt(QString("12,345"), &ok), 12345); + QCOMPARE(locale.numberOptions(), QLocale::OmitGroupSeparator); + QCOMPARE(locale.toInt(QString("12345"), &ok), 12345); QVERIFY(ok); QCOMPARE(locale.toInt(QString("12345"), &ok), 12345); QVERIFY(ok); - QCOMPARE(locale.toString(12345), QString("12,345")); + QCOMPARE(locale.toString(12345), QString("12345")); - locale.setNumberOptions(QLocale::OmitGroupSeparator); - QCOMPARE(locale.numberOptions(), QLocale::OmitGroupSeparator); + locale.setNumberOptions(0); + QCOMPARE(locale.numberOptions(), 0); QCOMPARE(locale.toInt(QString("12,345"), &ok), 12345); QVERIFY(ok); QCOMPARE(locale.toInt(QString("12345"), &ok), 12345); QVERIFY(ok); - QCOMPARE(locale.toString(12345), QString("12345")); + QCOMPARE(locale.toString(12345), QString("12,345")); locale.setNumberOptions(QLocale::RejectGroupSeparator); QCOMPARE(locale.numberOptions(), QLocale::RejectGroupSeparator); @@ -2033,10 +2034,10 @@ void tst_QLocale::standaloneMonthName() void tst_QLocale::currency() { const QLocale c(QLocale::C); - QCOMPARE(c.toCurrencyString(qulonglong(1234)), QString("1,234")); - QCOMPARE(c.toCurrencyString(qlonglong(-1234)), QString("-1,234")); - QCOMPARE(c.toCurrencyString(double(1234.56)), QString("1,234.56")); - QCOMPARE(c.toCurrencyString(double(-1234.56)), QString("-1,234.56")); + QCOMPARE(c.toCurrencyString(qulonglong(1234)), QString("1234")); + QCOMPARE(c.toCurrencyString(qlonglong(-1234)), QString("-1234")); + QCOMPARE(c.toCurrencyString(double(1234.56)), QString("1234.56")); + QCOMPARE(c.toCurrencyString(double(-1234.56)), QString("-1234.56")); const QLocale en_US("en_US"); QCOMPARE(en_US.toCurrencyString(qulonglong(1234)), QString("$1,234")); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 10747427c7..d18aa9f5f3 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -6255,14 +6255,15 @@ void tst_QString::arg_locale() QLocale l(QLocale::English, QLocale::UnitedKingdom); QString str("*%L1*%L2*"); - QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123,456*1,234.56*")); QLocale::setDefault(l); + QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123,456*1,234.56*")); l.setNumberOptions(QLocale::OmitGroupSeparator); QLocale::setDefault(l); QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123456*1234.56*")); QLocale::setDefault(QLocale::C); + QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123456*1234.56*")); } -- cgit v1.2.3 From 2042a091a3e88a77d52b6cdb62f3fc9153d7f5d7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 2 Oct 2015 14:39:23 +0200 Subject: QAbstractItemView::sizeHintForRow()/Column: Check for null delegate. The delegate may be null in QHeaderView. Task-number: QTBUG-48543 Change-Id: I4d3ba104b0b57431e8765271dc2dc880be096672 Reviewed-by: Giuseppe D'Angelo --- tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 7e73c19539..55fcf04846 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -239,6 +239,8 @@ private slots: void testStreamWithHide(); void testStylePosition(); + void sizeHintCrash(); + protected: void setupTestData(bool use_reset_model = false); void additionalInit(); @@ -2879,5 +2881,15 @@ void tst_QHeaderView::testStylePosition() QCOMPARE(proxy.lastPosition, QStyleOptionHeader::OnlyOneSection); } +void tst_QHeaderView::sizeHintCrash() +{ + QTreeView treeView; + QStandardItemModel *model = new QStandardItemModel(&treeView); + model->appendRow(new QStandardItem("QTBUG-48543")); + treeView.setModel(model); + treeView.header()->sizeHintForColumn(0); + treeView.header()->sizeHintForRow(0); +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" -- cgit v1.2.3 From c977c687cbfed64fac4a1550733d111a3d8cdca0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 8 Oct 2015 17:14:57 +0200 Subject: QMdiSubWindow: Do not close when doubleclicking on disabled Restore action. Check whether the action under the mouse is enabled before closing. Task-number: QTBUG-48493 Change-Id: I2a0669840b9b6c81dacdf179325301c02f1c0c35 Reviewed-by: Giuseppe D'Angelo --- .../widgets/qmdisubwindow/tst_qmdisubwindow.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index a6caa3d020..db252347ac 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -191,6 +191,7 @@ private slots: void fixedMinMaxSize(); #if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) void replaceMenuBarWhileMaximized(); + void closeOnDoubleClick_data(); void closeOnDoubleClick(); #endif void setFont(); @@ -1793,9 +1794,23 @@ void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() QVERIFY(!subWindow->maximizedSystemMenuIconWidget()); } +void tst_QMdiSubWindow::closeOnDoubleClick_data() +{ + QTest::addColumn("actionIndex"); + QTest::addColumn("expectClosed"); + + QTest::newRow("close") << 1 << true; + QTest::newRow("disabled-restore-action") << 0 << false; // QTBUG-48493 +} + void tst_QMdiSubWindow::closeOnDoubleClick() { + QFETCH(int, actionIndex); + QFETCH(bool, expectClosed); + QMdiArea mdiArea; + mdiArea.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag())); QPointer subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); @@ -1807,12 +1822,13 @@ void tst_QMdiSubWindow::closeOnDoubleClick() QVERIFY(systemMenu); QVERIFY(systemMenu->isVisible()); - sendMouseDoubleClick(systemMenu, QPoint(10, 10)); + const QRect actionGeometry = systemMenu->actionGeometry(systemMenu->actions().at(actionIndex)); + sendMouseDoubleClick(systemMenu, actionGeometry.center()); if (qApp->activePopupWidget() == static_cast(systemMenu)) systemMenu->hide(); qApp->processEvents(); - QVERIFY(!subWindow || !subWindow->isVisible()); QVERIFY(!systemMenu || !systemMenu->isVisible()); + QCOMPARE(subWindow.isNull() || !subWindow->isVisible(), expectClosed); } #endif -- cgit v1.2.3 From 85226dfed3332755d6cabadcc1e65d23e98ce1f8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Oct 2015 15:50:05 +0200 Subject: QLatin1String: add test QLatin1String wasn't really tested except as a drive-by. Unearthed a discrepancy with docs. Fixed the docs. Change-Id: I1246bb33888132edbc4e22da792a480a156357bf Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/tools/qlatin1string/.gitignore | 1 + .../corelib/tools/qlatin1string/qlatin1string.pro | 8 ++ .../tools/qlatin1string/tst_qlatin1string.cpp | 116 +++++++++++++++++++++ tests/auto/corelib/tools/tools.pro | 1 + 4 files changed, 126 insertions(+) create mode 100644 tests/auto/corelib/tools/qlatin1string/.gitignore create mode 100644 tests/auto/corelib/tools/qlatin1string/qlatin1string.pro create mode 100644 tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlatin1string/.gitignore b/tests/auto/corelib/tools/qlatin1string/.gitignore new file mode 100644 index 0000000000..dddf56b2df --- /dev/null +++ b/tests/auto/corelib/tools/qlatin1string/.gitignore @@ -0,0 +1 @@ +tst_qlatin1string diff --git a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro new file mode 100644 index 0000000000..219afa661b --- /dev/null +++ b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro @@ -0,0 +1,8 @@ +CONFIG += testcase parallel_test +TARGET = tst_qlatin1string +QT = core testlib +SOURCES = tst_qlatin1string.cpp +DEFINES += QT_NO_CAST_TO_ASCII +contains(QT_CONFIG,c++11): CONFIG += c++11 c++14 + +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp new file mode 100644 index 0000000000..5b83fe1958 --- /dev/null +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include + +class tst_QLatin1String : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void nullString(); + void emptyString(); +}; + +void tst_QLatin1String::nullString() +{ + // from nullptr + { + const char *null = Q_NULLPTR; + QLatin1String l1(null); + QCOMPARE(static_cast(l1.data()), static_cast(Q_NULLPTR)); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QVERIFY(s.isNull()); + } + + // from null QByteArray + { + const QByteArray null; + QVERIFY(null.isNull()); + + QLatin1String l1(null); + QEXPECT_FAIL("", "null QByteArrays become non-null QLatin1Strings...", Continue); + QCOMPARE(static_cast(l1.data()), static_cast(Q_NULLPTR)); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QEXPECT_FAIL("", "null QByteArrays become non-null QLatin1Strings become non-null QStrings...", Continue); + QVERIFY(s.isNull()); + } +} + +void tst_QLatin1String::emptyString() +{ + { + const char *empty = ""; + QLatin1String l1(empty); + QCOMPARE(static_cast(l1.data()), static_cast(empty)); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QVERIFY(s.isEmpty()); + QVERIFY(!s.isNull()); + } + + { + const char *notEmpty = "foo"; + QLatin1String l1(notEmpty, 0); + QCOMPARE(static_cast(l1.data()), static_cast(notEmpty)); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QVERIFY(s.isEmpty()); + QVERIFY(!s.isNull()); + } + + { + const QByteArray empty = ""; + QLatin1String l1(empty); + QCOMPARE(static_cast(l1.data()), static_cast(empty.constData())); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QVERIFY(s.isEmpty()); + QVERIFY(!s.isNull()); + } +} + + + +QTEST_APPLESS_MAIN(tst_QLatin1String) + +#include "tst_qlatin1string.moc" diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index 9024a1a1bb..f9e1c454e7 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -24,6 +24,7 @@ SUBDIRS=\ qhash \ qhash_strictiterators \ qhashfunctions \ + qlatin1string \ qline \ qlinkedlist \ qlist \ -- cgit v1.2.3 From dd8351b654180205c63e06c5099a1329762a91d2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Oct 2015 15:50:05 +0200 Subject: QLatin1String: add default ctor A pending change in uic depends on this. [ChangeLog][QtCore][QLatin1String] Added default constructor. Change-Id: Ie6f5dfc7b38683a488b0ff7f31404800ef5ee188 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp index 5b83fe1958..290c9fc12a 100644 --- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -46,6 +46,16 @@ private Q_SLOTS: void tst_QLatin1String::nullString() { + // default ctor + { + QLatin1String l1; + QCOMPARE(static_cast(l1.data()), static_cast(Q_NULLPTR)); + QCOMPARE(l1.size(), 0); + + QString s = l1; + QVERIFY(s.isNull()); + } + // from nullptr { const char *null = Q_NULLPTR; -- cgit v1.2.3 From 2a1d3f330d5f8cfc5358055b27e8e8301b3e050a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 20 Oct 2015 12:19:11 +0200 Subject: Add support for TEXTURE_EXTERNAL_OES in the internal texture blitter Assuming that the target is always GL_TEXTURE_2D is not going to be sufficient when working with EGLStreams for example where GL_TEXTURE_EXTERNAL_OES is a must. The blitter is now changed to support multiple programs so other targets can easily be added as well in the future, if necessary. Change-Id: I247d30600222fb5af6305ed5d9740baa5e43e83e Reviewed-by: Louai Al-Khanji --- tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp index 04c9b3f72c..2792f6f1a3 100644 --- a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp +++ b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp @@ -61,6 +61,7 @@ QOpenGLTextureBlitWindow::QOpenGLTextureBlitWindow() m_context->makeCurrent(this); m_blitter.create(); + qDebug("GL_TEXTURE_EXTERNAL_OES support: %d", m_blitter.supportsExternalOESTarget()); } void QOpenGLTextureBlitWindow::render() @@ -132,6 +133,12 @@ void QOpenGLTextureBlitWindow::render() m_blitter.setSwizzleRB(false); m_blitter.release(); + if (m_blitter.supportsExternalOESTarget()) { + // Cannot do much testing here, just verify that bind and release work, meaning that the program is present. + m_blitter.bind(0x8D65); + m_blitter.release(); + } + m_context->swapBuffers(this); } -- cgit v1.2.3 From a3abf9d76b3760b37f6e846c21570806974641f2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Oct 2015 14:18:01 +0200 Subject: Improve file handling in test of QSettings. - Avoid duplication of slashes and use static variable for the const part in settingsPath(). - Do not run expensive cleanup twice in init()/cleanup() as was before by moving the code into a separate cleanupTestData() function called from cleanup() and initTestCase(). - Use QDir::removeRecursively() (which should be able to deal with readonly files, etc after 26bcc0565f49c731a4f288f93f04056ca20136a5 ) instead of system calls or the special removePath() function for CE/RT. - Switch QStandardPaths into test mode. Change-Id: Idcde2d17020eae1ea43e448266e3940c06f174ef Reviewed-by: Simon Hausmann --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 93 +++++++---------------- 1 file changed, 29 insertions(+), 64 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 935eb7df89..19155cc3ad 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -89,12 +89,11 @@ class tst_QSettings : public QObject Q_OBJECT public: - tst_QSettings() : m_canWriteNativeSystemSettings(canWriteNativeSystemSettings()) {} + tst_QSettings(); public slots: void initTestCase(); - void init(); - void cleanup(); + void cleanup() { cleanupTestFiles(); } private slots: void getSetCheck(); void ctor_data(); @@ -165,6 +164,8 @@ private slots: void bom(); private: + void cleanupTestFiles(); + const bool m_canWriteNativeSystemSettings; }; @@ -180,39 +181,16 @@ void tst_QSettings::getSetCheck() QCOMPARE(true, obj1.fallbacksEnabled()); } -#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) -static void removePath(const QString& _path) -{ - QString path = _path; - QDir dir(path); - if (!dir.exists()) - return; - QStringList entries = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot); - foreach(QString name, entries) { - QString absolute = path + name; - if (QFileInfo(absolute).isDir()) - removePath(absolute+"\\"); - else - QFile::remove(absolute); - } - dir.cdUp(); - if (path[path.size()-1] == '\\') - path = path.left(path.size()-1); - dir.rmdir(path.mid(path.lastIndexOf('\\')+1)); -} -#endif - -static QString settingsPath(const char *path = "") +static QString settingsPath(const char *path = Q_NULLPTR) { // Temporary path for files that are specified explicitly in the constructor. #ifndef Q_OS_WINRT - QString tempPath = QDir::tempPath(); + static const QString tempPath = QDir::tempPath() + QLatin1String("/tst_QSettings"); #else - QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); + static const QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + + QLatin1String("/tst_QSettings"); #endif - if (tempPath.endsWith("/")) - tempPath.truncate(tempPath.size() - 1); - return QDir::toNativeSeparators(tempPath + "/tst_QSettings/" + QLatin1String(path)); + return path && *path ? tempPath + QLatin1Char('/') + QLatin1String(path) : tempPath; } static bool readCustom1File(QIODevice &device, QSettings::SettingsMap &map) @@ -282,6 +260,12 @@ static void populateWithFormats() QTest::newRow("custom2") << QSettings::CustomFormat2; } +tst_QSettings::tst_QSettings() + : m_canWriteNativeSystemSettings(canWriteNativeSystemSettings()) +{ + QStandardPaths::setTestModeEnabled(true); +} + void tst_QSettings::initTestCase() { if (!m_canWriteNativeSystemSettings) @@ -294,13 +278,19 @@ void tst_QSettings::initTestCase() ); QVERIFY(custom1 == QSettings::CustomFormat1); QVERIFY(custom2 == QSettings::CustomFormat2); + + cleanupTestFiles(); } -void tst_QSettings::init() +void tst_QSettings::cleanupTestFiles() { QSettings::setSystemIniPath(settingsPath("__system__")); QSettings::setUserIniPath(settingsPath("__user__")); + QDir settingsDir(settingsPath()); + if (settingsDir.exists()) + QVERIFY(settingsDir.removeRecursively()); + #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear(); @@ -316,17 +306,7 @@ void tst_QSettings::init() QSettings("HKEY_LOCAL_MACHINE\\Software\\bat", QSettings::NativeFormat).clear(); QSettings("HKEY_LOCAL_MACHINE\\Software\\baz", QSettings::NativeFormat).clear(); } - if (QDir(settingsPath()).exists()) { -#if defined(Q_OS_WINCE) - removePath(settingsPath()); -#else - if (QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) - system(QString("rmdir /Q /S %1").arg(settingsPath()).toLatin1()); - else - system(QString("deltree /Y %1").arg(settingsPath()).toLatin1()); -#endif - } -#elif defined(Q_OS_DARWIN) +#elif defined(Q_OS_DARWIN) || defined(Q_OS_WINRT) QSettings(QSettings::UserScope, "software.org", "KillerAPP").clear(); QSettings(QSettings::SystemScope, "software.org", "KillerAPP").clear(); QSettings(QSettings::UserScope, "other.software.org", "KillerAPP").clear(); @@ -337,31 +317,16 @@ void tst_QSettings::init() QSettings(QSettings::SystemScope, "other.software.org").clear(); #endif -#if !defined(Q_OS_WIN) - system(QString("chmod -R u+rw %1 2> /dev/null").arg(settingsPath()).toLatin1()); - system(QString("rm -fr %1 2> /dev/null").arg(settingsPath()).toLatin1()); -#endif + const QString foo(QLatin1String("foo")); #if defined(Q_OS_WINRT) - QSettings(QSettings::UserScope, "software.org", "KillerAPP").clear(); - QSettings(QSettings::SystemScope, "software.org", "KillerAPP").clear(); - QSettings(QSettings::UserScope, "other.software.org", "KillerAPP").clear(); - QSettings(QSettings::SystemScope, "other.software.org", "KillerAPP").clear(); - QSettings(QSettings::UserScope, "software.org").clear(); - QSettings(QSettings::SystemScope, "software.org").clear(); - QSettings(QSettings::UserScope, "other.software.org").clear(); - QSettings(QSettings::SystemScope, "other.software.org").clear(); - QSettings("foo", QSettings::NativeFormat).clear(); - removePath(settingsPath()); - QFile::remove(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/foo"); + QSettings(foo, QSettings::NativeFormat).clear(); + QFile fooFile(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1Char('/') + foo); #else - QFile::remove("foo"); + QFile fooFile(foo); #endif -} - -void tst_QSettings::cleanup() -{ - init(); + if (fooFile.exists()) + QVERIFY2(fooFile.remove(), qPrintable(fooFile.errorString())); } /* -- cgit v1.2.3 From d206d04b7c368754bca9c43d8a67895b4baa8893 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 21 Oct 2015 22:47:10 +0200 Subject: moc: fix Q_PROPERTY with parentheses in their MEMBER clause This was never a documented feature, but happended to work before Qt 5.5. It broke because the peoperty access went into the static function and are now prefixed with '_t->' So restore the behavior as it was by not including the parentheses in the member name. Task-number: QTBUG-47695 Change-Id: Ic3509ddea7ac9abc871e71f5bfbe81d04d08e9bc Reviewed-by: Gabriel de Dietrich --- tests/auto/tools/moc/tst_moc.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 4fa98b6ecb..c113b7cd60 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -513,6 +513,8 @@ class tst_Moc : public QObject Q_PROPERTY(QString member4 MEMBER sMember NOTIFY member4Changed) Q_PROPERTY(QString member5 MEMBER sMember NOTIFY member5Changed) Q_PROPERTY(QString member6 MEMBER sConst CONSTANT) + Q_PROPERTY(QString sub1 MEMBER (sub.m_string)) + Q_PROPERTY(QString sub2 READ (sub.string) WRITE (sub.setString)) public: inline tst_Moc() : sConst("const") {} @@ -626,6 +628,13 @@ private: QString sMember; const QString sConst; PrivatePropertyTest *pPPTest; + + struct { + QString m_string; + void setString(const QString &s) { m_string = s; } + QString string() { return m_string; } + } sub; + }; void tst_Moc::initTestCase() @@ -2044,6 +2053,10 @@ void tst_Moc::memberProperties_data() << 1 << "blub5" << "blub5Changed(const QString&)" << "mno" << true << "mno"; QTest::newRow("private MEMBER property with CONSTANT") << 1 << "blub6" << "" << "test" << false << "const"; + QTest::newRow("sub1") + << 0 << "sub1" << "" << "helloSub1" << true << "helloSub1"; + QTest::newRow("sub2") + << 0 << "sub2" << "" << "helloSub2" << true << "helloSub2"; } void tst_Moc::memberProperties() -- cgit v1.2.3