summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@qt.io>2018-12-06 10:29:58 +0100
committerJędrzej Nowacki <jedrzej.nowacki@qt.io>2018-12-06 11:58:27 +0000
commitd25b3b7f1059d5561bce3efe7ea903ea76d4e888 (patch)
tree90460ed067409dedb017be93294720a5243e0b1d
parenta8fed20181729cae70de43079c4a34ad1780cfd7 (diff)
Fix invalid QWaylandOutputMode comparison operator
Fixes: QTBUG-72288 Change-Id: I61fde92ea4275febbb4ec8c067280a4ca570d7c1 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandoutputmode.cpp4
-rw-r--r--tests/auto/compositor/compositor/tst_compositor.cpp23
2 files changed, 25 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutputmode.cpp b/src/compositor/compositor_api/qwaylandoutputmode.cpp
index 54587117..79a58160 100644
--- a/src/compositor/compositor_api/qwaylandoutputmode.cpp
+++ b/src/compositor/compositor_api/qwaylandoutputmode.cpp
@@ -89,7 +89,7 @@ QWaylandOutputMode &QWaylandOutputMode::operator=(const QWaylandOutputMode &othe
*/
bool QWaylandOutputMode::operator==(const QWaylandOutputMode &other) const
{
- return size() == other.size() && refreshRate() == refreshRate();
+ return size() == other.size() && refreshRate() == other.refreshRate();
}
/*!
@@ -98,7 +98,7 @@ bool QWaylandOutputMode::operator==(const QWaylandOutputMode &other) const
*/
bool QWaylandOutputMode::operator!=(const QWaylandOutputMode &other) const
{
- return size() != other.size() || refreshRate() != refreshRate();
+ return size() != other.size() || refreshRate() != other.refreshRate();
}
/*!
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index 281be28b..7fe8dfc2 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/compositor/tst_compositor.cpp
@@ -72,6 +72,7 @@ private slots:
void multipleClients();
void geometry();
void modes();
+ void comparingModes();
void sizeFollowsWindow();
void mapSurface();
void mapSurfaceHiDpi();
@@ -373,6 +374,28 @@ void tst_WaylandCompositor::modes()
QTRY_COMPARE(client.geometry, QRect(QPoint(0, 0), QSize(1920, 1080)));
}
+void tst_WaylandCompositor::comparingModes()
+{
+ QWaylandOutputMode mode1(QSize(800, 600), 120000);
+ QWaylandOutputMode mode2(QSize(1024, 768), 100000);
+ QWaylandOutputMode mode3(QSize(1024, 768), 120000);
+ QWaylandOutputMode mode4(QSize(800, 600), 100000);
+
+ QCOMPARE(mode1, mode1);
+ QCOMPARE(mode2, mode2);
+ QCOMPARE(mode3, mode3);
+ QCOMPARE(mode4, mode4);
+
+ for (auto mode: {mode2, mode3, mode4})
+ QVERIFY(mode1 != mode);
+ for (auto mode: {mode1, mode3, mode4})
+ QVERIFY(mode2 != mode);
+ for (auto mode: {mode1, mode2, mode4})
+ QVERIFY(mode3 != mode);
+ for (auto mode: {mode1, mode2, mode2})
+ QVERIFY(mode4 != mode);
+}
+
void tst_WaylandCompositor::sizeFollowsWindow()
{
TestCompositor compositor;