summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-14 10:49:20 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-14 10:52:24 +0100
commit0c034a649f61019c16aba479fe79d20dde41f2f2 (patch)
tree54545862591044b65e618989805945bceb0b3ea5 /tests/auto
parent2162f01111d21d0ce66ceb8be290b0a13653e691 (diff)
parentdf40b1115db600e8de1c4774476fa30956a34fd9 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/widgets/widgets/qpushbutton.cpp Change-Id: I615de00e6e64540c50f658d4d8ab3e002d701a81
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp6
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp76
-rw-r--r--tests/auto/tools/moc/cxx17-namespaces.h64
-rw-r--r--tests/auto/tools/moc/moc.pro2
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp25
-rw-r--r--tests/auto/tools/uic/baseline/chatmainwindow.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/mydialog.ui.h4
-rw-r--r--tests/auto/tools/uic/baseline/trpreviewtool.ui.h4
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp24
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp2
11 files changed, 184 insertions, 31 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 3f3533c9a1..03c28f4d0b 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -1026,7 +1026,7 @@ void tst_QProcess::softExitInSlots()
SoftExitProcess proc(signalToConnect);
proc.writeAfterStart("OLEBOLE", 8); // include the \0
proc.start(appName);
- QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
+ QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 60000);
QCOMPARE(proc.state(), QProcess::NotRunning);
}
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index d57c4629cc..78833d08bd 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -379,6 +379,8 @@ void tst_QMetaType::typeName_data()
QT_FOR_EACH_STATIC_TYPE(TYPENAME_DATA)
QTest::newRow("QMetaType::UnknownType") << int(QMetaType::UnknownType) << static_cast<const char*>(0);
+ QTest::newRow("QMetaType::User-1") << (int(QMetaType::User) - 1) << static_cast<const char *>(nullptr);
+ QTest::newRow("QMetaType::FirstWidgetsType-1") << (int(QMetaType::FirstWidgetsType) - 1) << static_cast<const char *>(nullptr);
QTest::newRow("Whity<double>") << ::qMetaTypeId<Whity<double> >() << QString::fromLatin1("Whity<double>");
QTest::newRow("Whity<int>") << ::qMetaTypeId<Whity<int> >() << QString::fromLatin1("Whity<int>");
@@ -407,10 +409,12 @@ void tst_QMetaType::typeName()
QFETCH(int, aType);
QFETCH(QString, aTypeName);
- QString name = QString::fromLatin1(QMetaType::typeName(aType));
+ const char *rawname = QMetaType::typeName(aType);
+ QString name = QString::fromLatin1(rawname);
QCOMPARE(name, aTypeName);
QCOMPARE(name.toLatin1(), QMetaObject::normalizedType(name.toLatin1().constData()));
+ QCOMPARE(rawname == nullptr, aTypeName.isNull());
}
void tst_QMetaType::type_data()
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index bd02dc6255..18649b3de5 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -133,6 +133,9 @@ private slots:
void gifImageCount();
void gifLoopCount();
+ void ppmMaxval_data();
+ void ppmMaxval();
+
void readCorruptImage_data();
void readCorruptImage();
void readCorruptBmp();
@@ -956,6 +959,79 @@ void tst_QImageReader::gifLoopCount()
}
}
+void tst_QImageReader::ppmMaxval_data()
+{
+ QTest::addColumn<bool>("hasColor");
+ QTest::addColumn<QByteArray>("bytes");
+
+ QTest::newRow("PGM plain 8bit full") << false << QByteArray("P2 3 1 255 255 0 127\n");
+ QTest::newRow("PGM plain 8bit lim.") << false << QByteArray("P2 3 1 50 50 0 25\n");
+ QTest::newRow("PGM plain 16bit full") << false << QByteArray("P2 3 1 65535 65535 0 32767\n");
+ QTest::newRow("PGM plain 16bit lim.") << false << QByteArray("P2 3 1 5000 5000 0 2500\n");
+ QTest::newRow("PGM raw 8bit full") << false << QByteArray("P5 3 1 255 \xff\x00\x7f", 13 + 3);
+ QTest::newRow("PGM raw 8bit lim.") << false << QByteArray("P5 3 1 50 \x32\x00\x19", 13 + 3);
+ QTest::newRow("PGM raw 16bit full") << false << QByteArray("P5 3 1 65535 \xff\xff\x00\x00\x7f\xff", 13 + 3 * 2);
+ QTest::newRow("PGM raw 16bit lim.") << false << QByteArray("P5 3 1 5000 \x13\x88\x00\x00\x09\xc4", 13 + 3 * 2);
+
+ QTest::newRow("PPM plain 8bit full") << true << QByteArray("P3 3 2 255 "
+ "255 255 255 0 0 0 127 127 127 "
+ "255 0 0 0 255 0 0 0 255\n");
+
+ QTest::newRow("PPM plain 8bit lim.") << true << QByteArray("P3 3 2 50 "
+ " 50 50 50 0 0 0 25 25 25 "
+ " 50 0 0 0 50 0 0 0 50\n");
+
+ QTest::newRow("PPM plain 16bit full") << true << QByteArray("P3 3 2 65535 "
+ "65535 65535 65535 0 0 0 32767 32767 32767 "
+ "65535 0 0 0 65535 0 0 0 65535\n");
+
+ QTest::newRow("PPM plain 16bit lim.") << true << QByteArray("P3 3 2 5000 "
+ " 5000 5000 5000 0 0 0 2500 2500 2500 "
+ " 5000 0 0 0 5000 0 0 0 5000\n");
+
+ QTest::newRow("PPM raw 8bit full") << true << QByteArray("P6 3 2 255 "
+ "\xff\xff\xff\x00\x00\x00\x7f\x7f\x7f"
+ "\xff\x00\x00\x00\xff\x00\x00\x00\xff", 13 + 6 * 3);
+
+ QTest::newRow("PPM raw 8bit lim.") << true << QByteArray("P6 3 2 50 "
+ "\x32\x32\x32\x00\x00\x00\x19\x19\x19"
+ "\x32\x00\x00\x00\x32\x00\x00\x00\x32", 13 + 6 * 3);
+
+ QTest::newRow("PPM raw 16bit full") << true << QByteArray("P6 3 2 65535 "
+ "\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x7f\xff\x7f\xff\x7f\xff"
+ "\xff\xff\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\xff\xff", 13 + 6 * 3 * 2);
+
+ QTest::newRow("PPM raw 16bit lim.") << true << QByteArray("P6 3 2 5000 "
+ "\x13\x88\x13\x88\x13\x88\x00\x00\x00\x00\x00\x00\x09\xc4\x09\xc4\x09\xc4"
+ "\x13\x88\x00\x00\x00\x00\x00\x00\x13\x88\x00\x00\x00\x00\x00\x00\x13\x88", 13 + 6 * 3 * 2);
+}
+
+void tst_QImageReader::ppmMaxval()
+{
+ SKIP_IF_UNSUPPORTED("ppm");
+
+ QFETCH(bool, hasColor);
+ QFETCH(QByteArray, bytes);
+
+ QImage img;
+ img.loadFromData(bytes);
+ QVERIFY(!img.isNull());
+ QCOMPARE(img.width(), 3);
+ QCOMPARE(img.height(), hasColor ? 2 : 1);
+
+ QCOMPARE(img.pixel(0,0), qRgb(0xff, 0xff, 0xff));
+ QCOMPARE(img.pixel(1,0), qRgb(0, 0, 0));
+ QRgb gray = img.pixel(2,0);
+ QVERIFY(qIsGray(gray));
+ QVERIFY(qRed(gray) > 0x70 && qRed(gray) < 0x90 );
+
+ if (hasColor) {
+ QCOMPARE(img.pixel(0,1), qRgb(0xff, 0, 0));
+ QCOMPARE(img.pixel(1,1), qRgb(0, 0xff, 0));
+ QCOMPARE(img.pixel(2,1), qRgb(0, 0, 0xff));
+ }
+}
+
class Server : public QObject
{
Q_OBJECT
diff --git a/tests/auto/tools/moc/cxx17-namespaces.h b/tests/auto/tools/moc/cxx17-namespaces.h
new file mode 100644
index 0000000000..7c9f54d5f3
--- /dev/null
+++ b/tests/auto/tools/moc/cxx17-namespaces.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Olivier Goffart.
+** 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$
+**
+****************************************************************************/
+
+#ifndef CXX17_NAMESPACES_H
+#define CXX11_NAMESPACES_H
+#include <QtCore/QObject>
+
+#if defined(__cpp_nested_namespace_definitions) || defined(Q_MOC_RUN)
+namespace CXX17Namespace::A::B {
+namespace C::D {
+namespace E::F::G { } // don't confuse moc
+#else
+namespace CXX17Namespace { namespace A { namespace B {
+namespace C { namespace D {
+#endif
+
+Q_NAMESPACE
+
+class ClassInNamespace
+{
+ Q_GADGET
+public:
+ enum GadEn { Value = 3 };
+ Q_ENUM(GadEn)
+};
+
+enum NamEn { Value = 4 };
+Q_ENUM_NS(NamEn);
+
+
+#if defined(__cpp_nested_namespace_definitions) || defined(Q_MOC_RUN)
+}
+}
+#else
+} } }
+} }
+#endif
+
+#endif
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index d2b750bdc5..b7151f9c16 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -29,7 +29,7 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
non-gadget-parent-class.h grand-parent-gadget-class.h \
related-metaobjects-in-gadget.h \
related-metaobjects-name-conflict.h \
- namespace.h
+ namespace.h cxx17-namespaces.h
if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index e704a6877e..2d7ec2f0b5 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -70,6 +70,7 @@
#include "non-gadget-parent-class.h"
#include "grand-parent-gadget-class.h"
#include "namespace.h"
+#include "cxx17-namespaces.h"
#ifdef Q_MOC_RUN
// check that moc can parse these constructs, they are being used in Windows winsock2.h header
@@ -521,6 +522,10 @@ public slots:
private:
myNS::Points m_points;
+#ifdef Q_MOC_RUN
+ int xx = 11'11; // digit separator must not confuse moc (QTBUG-59351)
+#endif
+
private slots:
inline virtual void blub1() {}
virtual inline void blub2() {}
@@ -696,6 +701,7 @@ private slots:
void optionsFileError_data();
void optionsFileError();
void testQNamespace();
+ void cxx17Namespaces();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -3799,6 +3805,25 @@ void tst_Moc::testQNamespace()
QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1);
}
+void tst_Moc::cxx17Namespaces()
+{
+ QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.className(),
+ "CXX17Namespace::A::B::C::D");
+ QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumeratorCount(), 1);
+ QCOMPARE(CXX17Namespace::A::B::C::D::staticMetaObject.enumerator(0).name(), "NamEn");
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().name(), "NamEn");
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().keyCount(), 1);
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::NamEn>().value(0), 4);
+
+ QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.className(),
+ "CXX17Namespace::A::B::C::D::ClassInNamespace");
+ QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumeratorCount(), 1);
+ QCOMPARE(CXX17Namespace::A::B::C::D::ClassInNamespace::staticMetaObject.enumerator(0).name(), "GadEn");
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().name(), "GadEn");
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().keyCount(), 1);
+ QCOMPARE(QMetaEnum::fromType<CXX17Namespace::A::B::C::D::ClassInNamespace::GadEn>().value(0), 3);
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS
diff --git a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
index 8cfd9b4851..7f8b026ba5 100644
--- a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
+++ b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'chatmainwindow.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.9.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -151,10 +151,14 @@ public:
{
ChatMainWindow->setWindowTitle(QApplication::translate("ChatMainWindow", "Qt D-Bus Chat", Q_NULLPTR));
actionQuit->setText(QApplication::translate("ChatMainWindow", "Quit", Q_NULLPTR));
+#ifndef QT_NO_SHORTCUT
actionQuit->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+Q", Q_NULLPTR));
+#endif // QT_NO_SHORTCUT
actionAboutQt->setText(QApplication::translate("ChatMainWindow", "About Qt...", Q_NULLPTR));
actionChangeNickname->setText(QApplication::translate("ChatMainWindow", "Change nickname...", Q_NULLPTR));
+#ifndef QT_NO_SHORTCUT
actionChangeNickname->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+N", Q_NULLPTR));
+#endif // QT_NO_SHORTCUT
#ifndef QT_NO_TOOLTIP
chatHistory->setToolTip(QApplication::translate("ChatMainWindow", "Messages sent and received from other users", Q_NULLPTR));
#endif // QT_NO_TOOLTIP
diff --git a/tests/auto/tools/uic/baseline/mydialog.ui.h b/tests/auto/tools/uic/baseline/mydialog.ui.h
index 061b476f63..279dd0e9bf 100644
--- a/tests/auto/tools/uic/baseline/mydialog.ui.h
+++ b/tests/auto/tools/uic/baseline/mydialog.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'mydialog.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.9.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -62,7 +62,9 @@ public:
MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Mach 2!", Q_NULLPTR));
aLabel->setText(QApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", Q_NULLPTR));
aButton->setText(QApplication::translate("MyDialog", "&Quit", Q_NULLPTR));
+#ifndef QT_NO_SHORTCUT
aButton->setShortcut(QApplication::translate("MyDialog", "Alt+Q", Q_NULLPTR));
+#endif // QT_NO_SHORTCUT
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
index d694ae5a8d..7545b4c803 100644
--- a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
+++ b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
@@ -31,7 +31,7 @@
/********************************************************************************
** Form generated from reading UI file 'trpreviewtool.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.9.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -168,7 +168,9 @@ public:
actionOpenForm->setText(QApplication::translate("TrPreviewToolClass", "&Open Form...", Q_NULLPTR));
actionLoadTranslation->setText(QApplication::translate("TrPreviewToolClass", "&Load Translation...", Q_NULLPTR));
actionReloadTranslations->setText(QApplication::translate("TrPreviewToolClass", "&Reload Translations", Q_NULLPTR));
+#ifndef QT_NO_SHORTCUT
actionReloadTranslations->setShortcut(QApplication::translate("TrPreviewToolClass", "F5", Q_NULLPTR));
+#endif // QT_NO_SHORTCUT
actionClose->setText(QApplication::translate("TrPreviewToolClass", "&Close", Q_NULLPTR));
actionAbout->setText(QApplication::translate("TrPreviewToolClass", "About", Q_NULLPTR));
actionAbout_Qt->setText(QApplication::translate("TrPreviewToolClass", "About Qt", Q_NULLPTR));
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 29e4bbfe29..a89f8f3c8a 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -150,7 +150,6 @@ private slots:
void horizontalScrollingByVerticalWheelEvents();
void taskQTBUG_7232_AllowUserToControlSingleStep();
void taskQTBUG_51086_skippingIndexesInSelectedIndexes();
- void expandingListItems();
void taskQTBUG_47694_indexOutOfBoundBatchLayout();
};
@@ -2488,29 +2487,6 @@ void tst_QListView::taskQTBUG_51086_skippingIndexesInSelectedIndexes()
QVERIFY(!indexes.contains(data.index(8, 0)));
}
-void tst_QListView::expandingListItems()
-{
- auto item1 = new QStandardItem("111");
- auto item2 = new QStandardItem("111111");
- QStandardItemModel model;
- model.appendRow(item1);
- model.appendRow(item2);
-
- QListView w;
- w.setModel(&model);
- w.setWrapping(true);
- w.show();
- QVERIFY(QTest::qWaitForWindowExposed(&w));
-
- QVERIFY(w.visualRect(item1->index()).width() > 0);
- QVERIFY(w.visualRect(item1->index()).width() == w.visualRect(item2->index()).width());
-
- w.setExpandingListItems(false);
- QApplication::processEvents();
-
- QVERIFY(w.visualRect(item1->index()).width() < w.visualRect(item2->index()).width());
-}
-
void tst_QListView::taskQTBUG_47694_indexOutOfBoundBatchLayout()
{
QListView view;
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 7afa7ca42b..5715505fd6 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -8181,7 +8181,7 @@ void tst_QWidget::customDpi()
custom->logicalDpiX();
QCOMPARE(custom->metricCallCount, 1);
child->logicalDpiX();
- QCOMPARE(custom->metricCallCount, 2);
+ QCOMPARE(custom->metricCallCount, 1);
}
void tst_QWidget::customDpiProperty()