core: fix MultiResourceTest intermittent failure
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 18 Feb 2014 23:26:56 +0000 (15:26 -0800)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 18 Feb 2014 23:26:56 +0000 (15:26 -0800)
The MultiResourceTest would fail occassionally when the test
surfaces got placed near the edges of the compositor output
or when the surfaces were overlapped.  Weston's shell places
surfaces in random positions, thus to avoid hitting the above
corner-cases we just position them explicitly with the wfits_manip
test extension.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/test/core/test_multi_resource.cpp
src/test/harness.cpp
src/test/harness.h

index d3fb003..0367bc1 100644 (file)
@@ -35,27 +35,28 @@ namespace test {
 namespace core {
 namespace input {
 
-class DummyClient
+class DummyClient : public Harness
 {
 public:
        DummyClient()
-               : display_()
-               , compositor_(display_)
-               , shell_(display_)
-               , seat_(display_)
+               : Harness::Harness()
+               , compositor_(display())
+               , shell_(display())
+               , seat_(display())
                , surface_(compositor_)
                , shellSurface_(shell_, surface_)
-               , shm_(display_)
+               , shm_(display())
                , buffer_(shm_, 128, 128)
        {
                wl_surface_attach(surface_, buffer_, 0, 0);
                wl_surface_damage(surface_, 0, 0,
                                  buffer_.width(), buffer_.height());
                surface_.commit();
+
+               setSurfacePosition(surface_, 300, 100);
        }
 
 private:
-       Display display_;
        Compositor compositor_;
        Shell shell_;
        Seat seat_;
@@ -111,6 +112,8 @@ void MultiResourceTest::setup()
        wl_surface_damage(surface_, 0, 0, buffer_.width(), buffer_.height());
        surface_.commit();
 
+       setSurfacePosition(surface_, 100, 100);
+
        queueStep(boost::bind(&MultiResourceTest::testPointer, boost::ref(*this)));
        queueStep(boost::bind(&MultiResourceTest::testKeyboard, boost::ref(*this)));
 }
index 54345a7..7e957f6 100644 (file)
@@ -123,6 +123,17 @@ void Harness::inputKeySend(int32_t key, int32_t state) const
        client().sendKey(key, state);
 }
 
+void Harness::setSurfacePosition(wl_surface *surface, int32_t x, int32_t y) const
+{
+       client().moveSurfaceTo(surface, x, y);
+
+       Geometry actual(getSurfaceGeometry(surface));
+       while (actual.x != x or actual.y != y)
+       {
+               actual = getSurfaceGeometry(surface);
+       }
+}
+
 } // namespace test
 } // namespace wfits
 
index a331481..7fff27f 100644 (file)
@@ -59,6 +59,7 @@ public:
        void            expectGlobalPointerPosition(int32_t, int32_t) const;
        void            expectGlobalPointerPosition(const Position&) const;
        void            inputKeySend(int32_t, int32_t) const;
+       void            setSurfacePosition(wl_surface*, int32_t, int32_t) const;
 
 protected:
        TestSteps       steps_;