summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tools')
-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.cpp41
-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
6 files changed, 117 insertions, 4 deletions
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 e746800c9f..5f1a0618ab 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);
@@ -2145,6 +2151,22 @@ void tst_Moc::warnings_data()
<< 0
<< QString()
<< QString("standard input:1: Note: No relevant classes found. No output generated.");
+
+ QTest::newRow("Q_PLUGIN_METADATA: invalid file")
+ << QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \"does.not.exists\") \n };")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:2: Error: Plugin Metadata file \"does.not.exists\" does not exist. Declaration will be ignored");
+
+#ifdef Q_OS_LINUX // Limit to Linux because the error message is platform-dependent
+ QTest::newRow("Q_PLUGIN_METADATA: unreadable file")
+ << QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \".\") \n };")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:2: Error: Plugin Metadata file \".\" could not be opened: file to open is a directory");
+#endif
}
void tst_Moc::warnings()
@@ -3787,6 +3809,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));