summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-03-29 13:56:38 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2012-03-29 17:45:46 +0200
commit6dbc6e183ba8c8e168d7979f2f67617ed643e57b (patch)
treed2c23d6924dcb86d7761016ba4c108d49dd1a6b3 /tests
parentdc152be5f5d5c888cddb6b4e897f621f05612297 (diff)
Introduced WaylandClient API to keep track of clients.
Makes it easier to keep track of which surfaces belong to a given client, and the client associated with a given surface. WaylandClient is an opaque type, representing an underlying wl_client *. Change-Id: If21a2e02eb13a860e6ac641875bdcca67a53fdf5 Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/compositor/tst_compositor.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp
index 0e632c4d1..3f35dd558 100644
--- a/tests/auto/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/tst_compositor.cpp
@@ -73,6 +73,16 @@ void tst_WaylandCompositor::singleClient()
wl_surface *sb = client.createSurface();
QTRY_COMPARE(compositor.surfaces.size(), 2);
+ WaylandClient *ca = compositor.surfaces.at(0)->client();
+ WaylandClient *cb = compositor.surfaces.at(1)->client();
+
+ QCOMPARE(ca, cb);
+
+ QList<WaylandSurface *> surfaces = compositor.surfacesForClient(ca);
+ QCOMPARE(surfaces.size(), 2);
+ QVERIFY((surfaces.at(0) == compositor.surfaces.at(0) && surfaces.at(1) == compositor.surfaces.at(1))
+ || (surfaces.at(0) == compositor.surfaces.at(1) && surfaces.at(1) == compositor.surfaces.at(0)));
+
wl_surface_destroy(sa);
QTRY_COMPARE(compositor.surfaces.size(), 1);
@@ -94,6 +104,23 @@ void tst_WaylandCompositor::multipleClients()
QTRY_COMPARE(compositor.surfaces.size(), 3);
+ WaylandClient *ca = compositor.surfaces.at(0)->client();
+ WaylandClient *cb = compositor.surfaces.at(1)->client();
+ WaylandClient *cc = compositor.surfaces.at(2)->client();
+
+ QVERIFY(ca != cb);
+ QVERIFY(ca != cc);
+ QVERIFY(cb != cc);
+
+ QCOMPARE(compositor.surfacesForClient(ca).size(), 1);
+ QCOMPARE(compositor.surfacesForClient(ca).at(0), compositor.surfaces.at(0));
+
+ QCOMPARE(compositor.surfacesForClient(cb).size(), 1);
+ QCOMPARE(compositor.surfacesForClient(cb).at(0), compositor.surfaces.at(1));
+
+ QCOMPARE(compositor.surfacesForClient(cc).size(), 1);
+ QCOMPARE(compositor.surfacesForClient(cc).at(0), compositor.surfaces.at(2));
+
wl_surface_destroy(sa);
wl_surface_destroy(sb);
wl_surface_destroy(sc);