summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-29 13:51:16 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-29 15:30:17 +0200
commit1cc571593a67f3e688a5cbb896f0be71ca5a2b30 (patch)
treec652360c9276cbf475244fd02313d64e3df11a96 /tests/manual
parent829c59aa4acf94bd979f6a3162808be36802d79a (diff)
parentcc74452d6d259d36ac47c536f11a5efb269e8e44 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/cocoa/menurama/main.cpp51
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.cpp86
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.h71
-rw-r--r--tests/manual/cocoa/menurama/mainwindow.ui289
-rw-r--r--tests/manual/cocoa/menurama/menurama.pro22
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.cpp81
-rw-r--r--tests/manual/cocoa/menurama/menuramaapplication.h58
-rw-r--r--tests/manual/dialogs/main.cpp6
-rw-r--r--tests/manual/qopenglwindow/multiwindow/main.cpp141
-rw-r--r--tests/manual/qscreen/propertyfield.cpp3
10 files changed, 752 insertions, 56 deletions
diff --git a/tests/manual/cocoa/menurama/main.cpp b/tests/manual/cocoa/menurama/main.cpp
new file mode 100644
index 0000000000..98d96b1491
--- /dev/null
+++ b/tests/manual/cocoa/menurama/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qtbase module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "menuramaapplication.h"
+
+int main(int argc, char *argv[])
+{
+ MenuramaApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/cocoa/menurama/mainwindow.cpp b/tests/manual/cocoa/menurama/mainwindow.cpp
new file mode 100644
index 0000000000..db8fdafc21
--- /dev/null
+++ b/tests/manual/cocoa/menurama/mainwindow.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qtbase module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "menuramaapplication.h"
+#include <QDebug>
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+
+ startTimer(1000);
+
+ connect(ui->menuAfter_aboutToShow, &QMenu::aboutToShow, [=] {
+ menuApp->populateMenu(ui->menuAfter_aboutToShow, true /*clear*/);
+ });
+
+ connect(ui->menuDynamic_Stuff, &QMenu::aboutToShow, [=] {
+ menuApp->addDynMenu(QLatin1String("Added After aboutToShow()"), ui->menuDynamic_Stuff);
+ });
+
+ connect(ui->pushButton, &QPushButton::clicked, [=] {
+ menuApp->populateMenu(ui->menuOn_Click, true /*clear*/);
+ });
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::timerEvent(QTimerEvent *)
+{
+ menuApp->populateMenu(ui->menuPopulated_by_Timer, true /*clear*/);
+ menuApp->addDynMenu(QLatin1String("Added by Timer"), ui->menuDynamic_Stuff);
+}
+
+void MainWindow::enableStuffMenu(bool enable)
+{
+ ui->menuStuff->setEnabled(enable);
+}
+
+void MainWindow::on_actionQuit_triggered()
+{
+ menuApp->exit();
+}
diff --git a/tests/manual/cocoa/menurama/mainwindow.h b/tests/manual/cocoa/menurama/mainwindow.h
new file mode 100644
index 0000000000..b9cb52d908
--- /dev/null
+++ b/tests/manual/cocoa/menurama/mainwindow.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qtbase module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+protected:
+ void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+
+public slots:
+ void enableStuffMenu(bool enable);
+
+private slots:
+ void on_actionQuit_triggered();
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/cocoa/menurama/mainwindow.ui b/tests/manual/cocoa/menurama/mainwindow.ui
new file mode 100644
index 0000000000..f73b41b861
--- /dev/null
+++ b/tests/manual/cocoa/menurama/mainwindow.ui
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <widget class="QCheckBox" name="checkBox">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>151</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Enable &quot;Stuff&quot; Menu</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>321</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>The &quot;Help&quot; menu should NOT be visible.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>80</y>
+ <width>211</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Populate Dynamic Submenu</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuStuff">
+ <property name="title">
+ <string>Stuff</string>
+ </property>
+ <widget class="QMenu" name="menuSubmenu">
+ <property name="title">
+ <string>Submenu</string>
+ </property>
+ <widget class="QMenu" name="menuMore_Submenu_2">
+ <property name="title">
+ <string>More Submenu</string>
+ </property>
+ <addaction name="actionMOARH"/>
+ </widget>
+ <addaction name="actionWith_More_Stuff"/>
+ <addaction name="menuMore_Submenu_2"/>
+ </widget>
+ <widget class="QMenu" name="menuDisabled_Submenu">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Disabled Submenu</string>
+ </property>
+ <widget class="QMenu" name="menuMore_Submenu">
+ <property name="title">
+ <string>More Submenu</string>
+ </property>
+ <addaction name="actionShould_be_Disabled_Too"/>
+ </widget>
+ <addaction name="actionShould_be_Disabled"/>
+ <addaction name="menuMore_Submenu"/>
+ </widget>
+ <addaction name="actionItem"/>
+ <addaction name="menuSubmenu"/>
+ <addaction name="actionDisabled_Item"/>
+ <addaction name="menuDisabled_Submenu"/>
+ </widget>
+ <widget class="QMenu" name="menuDisabled_Stuff">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Disabled Stuff</string>
+ </property>
+ <widget class="QMenu" name="menuSubmenu_2">
+ <property name="title">
+ <string>Disabled Submenu</string>
+ </property>
+ <widget class="QMenu" name="menuSubsubmenu">
+ <property name="title">
+ <string>Disabled Subsubmenu</string>
+ </property>
+ <addaction name="actionWith_its_own_Stuff"/>
+ </widget>
+ <addaction name="actionMore_Disabled_Stuff"/>
+ <addaction name="menuSubsubmenu"/>
+ </widget>
+ <addaction name="actionItem_2"/>
+ <addaction name="menuSubmenu_2"/>
+ </widget>
+ <widget class="QMenu" name="menuShould_NOT_Be_Visible">
+ <property name="title">
+ <string>Should NOT Be Visible</string>
+ </property>
+ <addaction name="actionAbout"/>
+ </widget>
+ <widget class="QMenu" name="menuHelp">
+ <property name="title">
+ <string>Help</string>
+ </property>
+ <addaction name="actionAbout_Qt"/>
+ </widget>
+ <widget class="QMenu" name="menuDynamic_Stuff">
+ <property name="title">
+ <string>Dynamic Stuff</string>
+ </property>
+ <widget class="QMenu" name="menuAfter_aboutToShow">
+ <property name="title">
+ <string>Populated After aboutToShow()</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menuOn_Click">
+ <property name="title">
+ <string>Click Button to Populate</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menuPopulated_by_Timer">
+ <property name="title">
+ <string>Populated by Timer</string>
+ </property>
+ </widget>
+ <addaction name="menuOn_Click"/>
+ <addaction name="menuAfter_aboutToShow"/>
+ <addaction name="menuPopulated_by_Timer"/>
+ </widget>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="actionNew"/>
+ <addaction name="actionNo_Empty_Spaces_Below"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuStuff"/>
+ <addaction name="menuDisabled_Stuff"/>
+ <addaction name="menuShould_NOT_Be_Visible"/>
+ <addaction name="menuDynamic_Stuff"/>
+ <addaction name="menuHelp"/>
+ </widget>
+ <widget class="QToolBar" name="mainToolBar">
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ <widget class="QStatusBar" name="statusBar"/>
+ <action name="actionWith_More_Stuff">
+ <property name="text">
+ <string>With More Stuff</string>
+ </property>
+ </action>
+ <action name="actionDisabled_Item">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Disabled Item</string>
+ </property>
+ </action>
+ <action name="actionItem">
+ <property name="text">
+ <string>Item</string>
+ </property>
+ </action>
+ <action name="actionShould_be_Disabled">
+ <property name="text">
+ <string>Should be Disabled</string>
+ </property>
+ </action>
+ <action name="actionShould_be_Disabled_Too">
+ <property name="text">
+ <string>Should be Disabled Too</string>
+ </property>
+ </action>
+ <action name="actionMOARH">
+ <property name="text">
+ <string>MOAR!!</string>
+ </property>
+ </action>
+ <action name="actionItem_2">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Disabled Item</string>
+ </property>
+ </action>
+ <action name="actionMore_Disabled_Stuff">
+ <property name="text">
+ <string>More Disabled Stuff</string>
+ </property>
+ </action>
+ <action name="actionWith_its_own_Stuff">
+ <property name="text">
+ <string>With its own Disabled Stuff</string>
+ </property>
+ </action>
+ <action name="actionAbout">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </action>
+ <action name="actionAbout_Qt">
+ <property name="text">
+ <string>About Qt</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </action>
+ <action name="actionNew">
+ <property name="text">
+ <string>New...</string>
+ </property>
+ </action>
+ <action name="actionNo_Empty_Spaces_Below">
+ <property name="text">
+ <string>No Empty Spaces Below</string>
+ </property>
+ </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>checkBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MainWindow</receiver>
+ <slot>enableStuffMenu(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>62</x>
+ <y>94</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>72</x>
+ <y>73</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>enableStuffMenu(bool)</slot>
+ </slots>
+</ui>
diff --git a/tests/manual/cocoa/menurama/menurama.pro b/tests/manual/cocoa/menurama/menurama.pro
new file mode 100644
index 0000000000..da6f224e0d
--- /dev/null
+++ b/tests/manual/cocoa/menurama/menurama.pro
@@ -0,0 +1,22 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2016-08-10T14:21:46
+#
+#-------------------------------------------------
+
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = Menurama
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+ mainwindow.cpp \
+ menuramaapplication.cpp
+
+HEADERS += mainwindow.h \
+ menuramaapplication.h
+
+FORMS += mainwindow.ui
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.cpp b/tests/manual/cocoa/menurama/menuramaapplication.cpp
new file mode 100644
index 0000000000..534d5fa371
--- /dev/null
+++ b/tests/manual/cocoa/menurama/menuramaapplication.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qtbase module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "menuramaapplication.h"
+
+MenuramaApplication::MenuramaApplication(int argc, char **argv)
+ : QApplication (argc, argv)
+{
+#if 0
+ QMenuBar *mb = new QMenuBar();
+ QMenu *menu = mb->addMenu("App Dynamic");
+ QMenu *dynMenu = menu->addMenu("After aboutToShow()");
+ connect(dynMenu, &QMenu::aboutToShow, [=] {
+ qDebug() << "aboutToShow(), populating" << dynMenu;
+ menuApp->populateMenu(dynMenu, true /*clear*/);
+ });
+#endif
+}
+
+void MenuramaApplication::populateMenu(QMenu *menu, bool clear)
+{
+ if (clear)
+ menu->clear();
+
+ static const char *sym[] = { "Foo", "Bar", "Baz", "Huux" };
+ static int id = 0;
+ for (unsigned i = 0; i < sizeof(sym) / sizeof(sym[0]); i++)
+ menu->addAction(QStringLiteral("%1 — %2 %3 ")
+ .arg(menu->title()).arg(sym[i]).arg(id));
+ ++id;
+}
+
+void MenuramaApplication::addDynMenu(QLatin1String title, QMenu *parentMenu)
+{
+ foreach (QAction *a, parentMenu->actions())
+ if (a->text() == title) {
+ parentMenu->removeAction(a);
+ break;
+ }
+
+ QMenu *subMenu = new QMenu(title, parentMenu);
+ populateMenu(subMenu, false /*clear*/);
+ parentMenu->addMenu(subMenu);
+}
diff --git a/tests/manual/cocoa/menurama/menuramaapplication.h b/tests/manual/cocoa/menurama/menuramaapplication.h
new file mode 100644
index 0000000000..07c8da27a1
--- /dev/null
+++ b/tests/manual/cocoa/menurama/menuramaapplication.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qtbase module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MENURAMAAPPLICATION_H
+#define MENURAMAAPPLICATION_H
+
+#include <QtWidgets>
+
+#define menuApp (static_cast<MenuramaApplication *>(QCoreApplication::instance()))
+
+class MenuramaApplication : public QApplication
+{
+public:
+ MenuramaApplication(int argc, char **argv);
+ void addDynMenu(QLatin1String title, QMenu *parentMenu);
+
+public slots:
+ void populateMenu(QMenu *menu, bool clear);
+};
+
+#endif // MENURAMAAPPLICATION_H
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index d1c7949777..f0f4e437e9 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -80,6 +80,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
int main(int argc, char *argv[])
{
+ for (int a = 1; a < argc; ++a) {
+ if (!qstrcmp(argv[a], "-n")) {
+ qDebug("AA_DontUseNativeDialogs");
+ QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
+ }
+ }
QApplication a(argc, argv);
MainWindow w;
w.move(500, 200);
diff --git a/tests/manual/qopenglwindow/multiwindow/main.cpp b/tests/manual/qopenglwindow/multiwindow/main.cpp
index e2a2d899a0..0788408b47 100644
--- a/tests/manual/qopenglwindow/multiwindow/main.cpp
+++ b/tests/manual/qopenglwindow/multiwindow/main.cpp
@@ -32,26 +32,22 @@
#include <QOpenGLFunctions>
#include <QPainter>
#include <QElapsedTimer>
+#include <QCommandLineParser>
+#include <QScreen>
+
+const char applicationDescription[] = "\n\
+This application opens multiple windows and continuously schedules updates for\n\
+them. Each of them is a separate QOpenGLWindow so there will be a separate\n\
+context and swapBuffers call for each.\n\
+\n\
+By default the swap interval is 1 so the effect of multiple blocking swapBuffers\n\
+on the main thread can be examined. (the result is likely to be different\n\
+between platforms, for example OS X is buffer queuing meaning that it can\n\
+block outside swap, resulting in perfect vsync for all three windows, while\n\
+other systems that block on swap will kill the frame rate due to blocking the\n\
+thread three times)\
+";
-// This application opens three windows and continuously schedules updates for
-// them. Each of them is a separate QOpenGLWindow so there will be a separate
-// context and swapBuffers call for each.
-//
-// By default the swap interval is 1 so the effect of three blocking swapBuffers
-// on the main thread can be examined. (the result is likely to be different
-// between platforms, for example OS X is buffer queuing meaning that it can
-// block outside swap, resulting in perfect vsync for all three windows, while
-// other systems that block on swap will kill the frame rate due to blocking the
-// thread three times)
-//
-// Pass --novsync to set a swap interval of 0. This should give an unthrottled
-// refresh on all platforms for all three windows.
-//
-// Passing --vsyncone sets swap interval to 1 for the first window and 0 to the
-// others.
-//
-// Pass --extrawindows N to open N windows in addition to the default 3.
-//
// For reference, below is a table of some test results.
//
// swap interval 1 for all swap interval 1 for only one and 0 for others
@@ -64,12 +60,15 @@
class Window : public QOpenGLWindow
{
+ Q_OBJECT
public:
Window(int n) : idx(n) {
r = g = b = fps = 0;
y = 0;
resize(200, 200);
- t2.start();
+
+ connect(this, SIGNAL(frameSwapped()), SLOT(frameSwapped()));
+ fpsTimer.start();
}
void paintGL() {
@@ -101,27 +100,52 @@ public:
if (y > height() - 20)
y = 20;
- if (t2.elapsed() > 1000) {
- fps = 1000.0 / t.elapsed();
- t2.restart();
- }
- t.restart();
-
update();
}
+public slots:
+ void frameSwapped() {
+ ++framesSwapped;
+ if (fpsTimer.elapsed() > 1000) {
+ fps = qRound(framesSwapped * (1000.0 / fpsTimer.elapsed()));
+ framesSwapped = 0;
+ fpsTimer.restart();
+ }
+ }
+
private:
int idx;
- GLfloat r, g, b, fps;
+ GLfloat r, g, b;
int y;
- QElapsedTimer t, t2;
+
+ int framesSwapped;
+ QElapsedTimer fpsTimer;
+ int fps;
};
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription(applicationDescription);
+ parser.addHelpOption();
+
+ QCommandLineOption noVsyncOption("novsync", "Disable Vsync by setting swap interval to 0. "
+ "This should give an unthrottled refresh on all platforms for all windows.");
+ parser.addOption(noVsyncOption);
+
+ QCommandLineOption vsyncOneOption("vsyncone", "Enable Vsync only for first window, "
+ "by setting swap interval to 1 for the first window and 0 for the others.");
+ parser.addOption(vsyncOneOption);
+
+ QCommandLineOption numWindowsOption("numwindows", "Open <N> windows instead of the default 3.", "N", "3");
+ parser.addOption(numWindowsOption);
+
+ parser.process(app);
+
QSurfaceFormat fmt;
- if (QGuiApplication::arguments().contains(QLatin1String("--novsync"))) {
+ if (parser.isSet(noVsyncOption)) {
qDebug("swap interval 0 (no throttling)");
fmt.setSwapInterval(0);
} else {
@@ -129,36 +153,41 @@ int main(int argc, char **argv)
}
QSurfaceFormat::setDefaultFormat(fmt);
- Window w1(0);
- if (QGuiApplication::arguments().contains(QLatin1String("--vsyncone"))) {
- qDebug("swap interval 1 for first window only");
- QSurfaceFormat w1fmt = fmt;
- w1fmt.setSwapInterval(1);
- w1.setFormat(w1fmt);
- fmt.setSwapInterval(0);
- QSurfaceFormat::setDefaultFormat(fmt);
- }
- Window w2(1);
- Window w3(2);
- w1.setGeometry(QRect(QPoint(10, 100), w1.size()));
- w2.setGeometry(QRect(QPoint(300, 100), w2.size()));
- w3.setGeometry(QRect(QPoint(600, 100), w3.size()));
- w1.show();
- w2.show();
- w3.show();
-
- QList<QWindow *> extraWindows;
- int countIdx;
- if ((countIdx = QGuiApplication::arguments().indexOf(QLatin1String("--extrawindows"))) >= 0) {
- int extraWindowCount = QGuiApplication::arguments().at(countIdx + 1).toInt();
- for (int i = 0; i < extraWindowCount; ++i) {
- Window *w = new Window(3 + i);
- extraWindows << w;
- w->show();
+ QRect availableGeometry = app.primaryScreen()->availableGeometry();
+
+ int numberOfWindows = qMax(parser.value(numWindowsOption).toInt(), 1);
+ QList<QWindow *> windows;
+ for (int i = 0; i < numberOfWindows; ++i) {
+ Window *w = new Window(i + 1);
+ windows << w;
+
+ if (i == 0 && parser.isSet(vsyncOneOption)) {
+ qDebug("swap interval 1 for first window only");
+ QSurfaceFormat vsyncedSurfaceFormat = fmt;
+ vsyncedSurfaceFormat.setSwapInterval(1);
+ w->setFormat(vsyncedSurfaceFormat);
+ fmt.setSwapInterval(0);
+ QSurfaceFormat::setDefaultFormat(fmt);
}
+
+ static int windowWidth = w->width() + 20;
+ static int windowHeight = w->height() + 20;
+
+ static int windowsPerRow = availableGeometry.width() / windowWidth;
+
+ int col = i;
+ int row = col / windowsPerRow;
+ col -= row * windowsPerRow;
+
+ QPoint position = availableGeometry.topLeft();
+ position += QPoint(col * windowWidth, row * windowHeight);
+ w->setFramePosition(position);
+ w->show();
}
int r = app.exec();
- qDeleteAll(extraWindows);
+ qDeleteAll(windows);
return r;
}
+
+#include "main.moc"
diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp
index 94a85545fb..e310798573 100644
--- a/tests/manual/qscreen/propertyfield.cpp
+++ b/tests/manual/qscreen/propertyfield.cpp
@@ -44,6 +44,9 @@ PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidge
QString PropertyField::valueToString(QVariant val)
{
+ if (m_prop.isEnumType())
+ return QString::fromUtf8(m_prop.enumerator().valueToKey(val.toInt()));
+
QString text;
switch (val.type()) {
case QVariant::Double: