summaryrefslogtreecommitdiffstats
path: root/tests/auto/compositor/compositor/tst_compositor.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-05-17 11:07:02 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-05-21 10:48:37 +0200
commit5f2e1d94c07c3d4d2f0f24598f8ab385fad3b74c (patch)
tree9fbf0dadcbee835e367952aff84e41055de9f230 /tests/auto/compositor/compositor/tst_compositor.cpp
parent7107f7501df329cf785cec1585767e5d7cbab6c2 (diff)
Eradicate Q_FOREACH loops [1/2]: trivial cases
In this patch, we port Q_FOREACH loops to C++11 ranged-for loops. All cases are trivial in the sense that either the argument is already const or is trivially marked as const, either by qAsConst(), or, in the case of rvalues, by storing to a const auto temporary first. In addition, all loop bodies are clear enough to confirm that the container we iterate over is not changed under iteration. This does not exclude cases where a loop is prematurely exited just after calling a modifier on the container, as that is safe, if not especially elegant. Change-Id: I87a63f07797437d421567d60e52305391a3c4f21 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'tests/auto/compositor/compositor/tst_compositor.cpp')
-rw-r--r--tests/auto/compositor/compositor/tst_compositor.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp
index c425f2ba..66792621 100644
--- a/tests/auto/compositor/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/compositor/tst_compositor.cpp
@@ -715,9 +715,8 @@ void tst_WaylandCompositor::seatCreation()
// The compositor will create the default input device
QTRY_VERIFY(seat->isInitialized());
- QList<QMouseEvent *> allEvents;
- allEvents += seat->createMouseEvents(5);
- foreach (QMouseEvent *me, allEvents) {
+ const QList<QMouseEvent *> allEvents = seat->createMouseEvents(5);
+ for (QMouseEvent *me : allEvents) {
compositor.seatFor(me);
}