summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-03 15:49:15 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-03 15:49:15 +0200
commit6357813207c866c99aadfd91af8fb3affe891f1d (patch)
tree69464d415b12ebaa3e57d88d7b5cd113878be988 /tests/manual
parent5a76a3fb03f8d1dc8cb367de1a1dc6a37048376a (diff)
parentb3fcaea5f2b97d3f562add97aee48cbb469c875a (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: configure src/3rdparty/double-conversion/include/double-conversion/utils.h src/corelib/global/qnamespace.qdoc src/corelib/tools/qsimd_p.h tests/auto/corelib/io/qfile/tst_qfile.cpp Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp2
-rw-r--r--tests/manual/network_stresstest/tst_network_stresstest.cpp2
-rw-r--r--tests/manual/qscreen/main.cpp67
3 files changed, 69 insertions, 2 deletions
diff --git a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
index 0035d47c88..05ede9da99 100644
--- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
+++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
@@ -139,7 +139,7 @@ void tst_NetworkRemoteStressTest::init()
{
// clear the internal cache
#ifndef QT_BUILD_INTERNAL
- if (strncmp(QTest::currentTestFunction(), "nam") == 0)
+ if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0)
QSKIP("QNetworkAccessManager tests disabled");
#endif
}
diff --git a/tests/manual/network_stresstest/tst_network_stresstest.cpp b/tests/manual/network_stresstest/tst_network_stresstest.cpp
index 9e04d52c4a..e3c76ea11b 100644
--- a/tests/manual/network_stresstest/tst_network_stresstest.cpp
+++ b/tests/manual/network_stresstest/tst_network_stresstest.cpp
@@ -130,7 +130,7 @@ void tst_NetworkStressTest::init()
{
// clear the internal cache
#ifndef QT_BUILD_INTERNAL
- if (strncmp(QTest::currentTestFunction(), "nam") == 0)
+ if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0)
QSKIP("QNetworkAccessManager tests disabled");
#endif
}
diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp
index f9f93fd525..445af82e09 100644
--- a/tests/manual/qscreen/main.cpp
+++ b/tests/manual/qscreen/main.cpp
@@ -40,6 +40,61 @@
#include <QStatusBar>
#include <QLineEdit>
#include <QDesktopWidget>
+#include <QPushButton>
+#include <QLabel>
+#include <QMouseEvent>
+
+
+class MouseMonitor : public QLabel {
+ Q_OBJECT
+public:
+ MouseMonitor() : m_grabbed(false) {
+ setMinimumSize(540, 240);
+ setAlignment(Qt::AlignCenter);
+ setMouseTracking(true);
+ setWindowTitle(QLatin1String("Mouse Monitor"));
+ updateText();
+ }
+
+ void updateText() {
+ QString txt = m_grabbed ?
+ QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") :
+ QLatin1String("Left-click to grab mouse\n");
+ if (!m_cursorPos.isNull()) {
+ txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n"))
+ .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos));
+ if (QGuiApplication::mouseButtons() & Qt::LeftButton) {
+ QWindow *win = QGuiApplication::topLevelAt(m_cursorPos);
+ txt += QString(QLatin1String("Top-level window found? %1\n"))
+ .arg(win ? (win->title().isEmpty() ? "no title" : win->title()) : "none");
+ }
+ }
+ setText(txt);
+ }
+
+protected:
+ void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE {
+ m_cursorPos = ev->screenPos().toPoint();
+ updateText();
+ }
+
+ void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE {
+ m_cursorPos = ev->screenPos().toPoint();
+ qDebug() << "top level @" << m_cursorPos << ":" << QGuiApplication::topLevelAt(m_cursorPos);
+ updateText();
+ if (!m_grabbed) {
+ grabMouse(Qt::CrossCursor);
+ m_grabbed = true;
+ } else if (ev->button() == Qt::RightButton) {
+ setVisible(false);
+ deleteLater();
+ }
+ }
+
+private:
+ QPoint m_cursorPos;
+ bool m_grabbed;
+};
class ScreenPropertyWatcher : public PropertyWatcher
{
@@ -96,6 +151,7 @@ public:
protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void startMouseMonitor();
private:
const QString m_annotation;
@@ -119,6 +175,11 @@ ScreenWatcherMainWindow::ScreenWatcherMainWindow(QScreen *screen)
a = fileMenu->addAction(QLatin1String("Quit"));
a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
connect(a, SIGNAL(triggered()), qApp, SLOT(quit()));
+
+ QMenu *toolsMenu = menuBar()->addMenu(QLatin1String("&Tools"));
+ a = toolsMenu->addAction(QLatin1String("Mouse Monitor"));
+ a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
+ connect(a, &QAction::triggered, this, &ScreenWatcherMainWindow::startMouseMonitor);
}
static inline QString msgScreenChange(const QWidget *w, const QScreen *oldScreen, const QScreen *newScreen)
@@ -154,6 +215,12 @@ bool ScreenWatcherMainWindow::event(QEvent *event)
return QMainWindow::event(event);
}
+void ScreenWatcherMainWindow::startMouseMonitor()
+{
+ MouseMonitor *mm = new MouseMonitor();
+ mm->show();
+}
+
void screenAdded(QScreen* screen)
{
screen->setOrientationUpdateMask((Qt::ScreenOrientations)0x0F);