summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-25 01:00:25 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-25 11:30:04 +0100
commit58c69df4d38324644bc49ec5f42ee8343a454b2d (patch)
treede0a1ce603292dcaff134d4e1e8ab064295515a2 /tests/manual
parent03b1d2c44940322208c12c7bceee376b51d8e852 (diff)
parent59a705e3710b0ba93bb698e3223241cfac932948 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/corelib/tools/qhash.h src/gui/kernel/qevent.h src/widgets/kernel/qshortcut.cpp src/widgets/kernel/qshortcut.h Change-Id: If61c206ee43ad1d97f5b07f58ac93c4583ce5620
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/diaglib/nativewindowdump_win.cpp71
-rw-r--r--tests/manual/rhi/shared/examplefw.h6
-rw-r--r--tests/manual/rhi/triquadcube/texturedcuberenderer.cpp2
-rw-r--r--tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp2
-rw-r--r--tests/manual/windowflags/controls.cpp2
5 files changed, 73 insertions, 10 deletions
diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp
index aae8746413..d91e673d1c 100644
--- a/tests/manual/diaglib/nativewindowdump_win.cpp
+++ b/tests/manual/diaglib/nativewindowdump_win.cpp
@@ -32,6 +32,7 @@
#include <QtCore/QTextStream>
#include <QtCore/QSharedPointer>
#include <QtCore/QDebug>
+#include <QtCore/QRect>
#include <QtCore/QVector>
#include <QtCore/qt_windows.h>
@@ -54,14 +55,76 @@ struct DumpContext {
if (style & styleConstant) \
str << ' ' << #styleConstant;
+static QTextStream &operator<<(QTextStream &str, const QPoint &p)
+{
+ str << p.x() << ", " << p.y();
+ return str;
+}
+
+static QTextStream &operator<<(QTextStream &str, const QSize &s)
+{
+ str << s.width() << 'x' << s.height();
+ return str;
+}
+
+static QTextStream &operator<<(QTextStream &str, const QRect &rect)
+{
+ str << rect.size() << forcesign << rect.x() << rect.y() << noforcesign;
+ return str;
+}
+
+static inline QSize qsizeFromRECT(const RECT &rect)
+{
+ return QSize(rect.right -rect.left, rect.bottom - rect.top);
+}
+
+static inline QRect qrectFromRECT(const RECT &rect)
+{
+ return QRect(QPoint(rect.left, rect.top), qsizeFromRECT(rect));
+}
+
+static QRect getFrameGeometry(HWND hwnd)
+{
+ RECT rect;
+ return GetWindowRect(hwnd, &rect) ? qrectFromRECT(rect) : QRect();
+}
+
+static QPoint getClientAreaScreenPos(HWND hwnd)
+{
+ POINT clientPos{0, 0};
+ return ClientToScreen(hwnd, &clientPos) ? QPoint(clientPos.x, clientPos.y) : QPoint();
+}
+
+static QRect getClientAreaGeometry(HWND hwnd)
+{
+ RECT clientRect;
+ return GetClientRect(hwnd, &clientRect)
+ ? QRect(getClientAreaScreenPos(hwnd), qsizeFromRECT(clientRect)) : QRect();
+}
+
+static bool isTopLevel(HWND hwnd)
+{
+ auto parent = GetParent(hwnd);
+ return !parent || parent == GetDesktopWindow();
+}
+
static void formatNativeWindow(HWND hwnd, QTextStream &str)
{
str << hex << showbase << quintptr(hwnd) << noshowbase << dec;
- RECT rect;
- if (GetWindowRect(hwnd, &rect)) {
- str << ' ' << (rect.right - rect.left) << 'x' << (rect.bottom - rect.top)
- << forcesign << rect.left << rect.top << noforcesign;
+
+ const bool topLevel = isTopLevel(hwnd);
+ if (topLevel)
+ str << " [top]";
+ const auto frameGeometry = getFrameGeometry(hwnd);
+ const auto clientGeometry = getClientAreaGeometry(hwnd);
+ str << ' ' << frameGeometry;
+ if (!topLevel)
+ str << " local: " << (clientGeometry.topLeft() - getClientAreaScreenPos(GetParent(hwnd)));
+ if (clientGeometry != frameGeometry) {
+ str << " client: " << clientGeometry << " frame: "
+ << (clientGeometry.topLeft() - frameGeometry.topLeft());
}
+
if (IsWindowVisible(hwnd))
str << " [visible]";
diff --git a/tests/manual/rhi/shared/examplefw.h b/tests/manual/rhi/shared/examplefw.h
index d28bbea0a8..bfe1ee6d2b 100644
--- a/tests/manual/rhi/shared/examplefw.h
+++ b/tests/manual/rhi/shared/examplefw.h
@@ -123,9 +123,9 @@ QString graphicsApiName()
QRhi::Flags rhiFlags = QRhi::EnableDebugMarkers;
int sampleCount = 1;
-QRhiSwapChain::Flags scFlags = 0;
-QRhi::BeginFrameFlags beginFrameFlags = 0;
-QRhi::EndFrameFlags endFrameFlags = 0;
+QRhiSwapChain::Flags scFlags;
+QRhi::BeginFrameFlags beginFrameFlags;
+QRhi::EndFrameFlags endFrameFlags;
int framesUntilTdr = -1;
bool transparentBackground = false;
diff --git a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp
index 8c5845d4fc..d8dea6d91f 100644
--- a/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp
+++ b/tests/manual/rhi/triquadcube/texturedcuberenderer.cpp
@@ -78,7 +78,7 @@ void TexturedCubeRenderer::initResources(QRhiRenderPassDescriptor *rp)
m_ubuf->build();
m_image = QImage(QLatin1String(":/qt256.png")).convertToFormat(QImage::Format_RGBA8888);
- QRhiTexture::Flags texFlags = 0;
+ QRhiTexture::Flags texFlags;
if (MIPMAP)
texFlags |= QRhiTexture::MipMapped;
if (AUTOGENMIPMAP)
diff --git a/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp b/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp
index 250ae3a2ee..3a58eed6ce 100644
--- a/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp
+++ b/tests/manual/rhi/triquadcube/triangleoncuberenderer.cpp
@@ -158,7 +158,7 @@ void TriangleOnCubeRenderer::initResources(QRhiRenderPassDescriptor *rp)
m_ps->build();
- QRhiTextureRenderTarget::Flags rtFlags = 0;
+ QRhiTextureRenderTarget::Flags rtFlags;
if (IMAGE_UNDER_OFFSCREEN_RENDERING)
rtFlags |= QRhiTextureRenderTarget::PreserveColorContents;
diff --git a/tests/manual/windowflags/controls.cpp b/tests/manual/windowflags/controls.cpp
index c167e5f8bf..b999a59abe 100644
--- a/tests/manual/windowflags/controls.cpp
+++ b/tests/manual/windowflags/controls.cpp
@@ -95,7 +95,7 @@ HintControl::HintControl(QWidget *parent)
Qt::WindowFlags HintControl::hints() const
{
- Qt::WindowFlags flags = 0;
+ Qt::WindowFlags flags;
if (msWindowsFixedSizeDialogCheckBox->isChecked())
flags |= Qt::MSWindowsFixedSizeDialogHint;
if (x11BypassWindowManagerCheckBox->isChecked())