summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLi Qiu <li.qiu@nomovok.com>2014-09-02 17:25:39 +0300
committerLi Qiu <li.qiu@yahoo.com>2014-09-04 09:29:43 +0200
commita6a288ecce01082de69ec17a0493c859a8e6fde6 (patch)
treec726f39f6ea807dcd7aa52b638c85a66e2dc2151 /tests
parent3538efae35dcbd4adf1361598deae0d198bbe13f (diff)
downloadqtwayland-a6a288ecce01082de69ec17a0493c859a8e6fde6.tar.gz
Fix crash of test client
No wl_data_device_manager created in Mock compositor Change-Id: If80f71165c28678f296bc18f0fea572dcb1a2f77 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/mockcompositor.cpp2
-rw-r--r--tests/auto/client/mockcompositor.h2
-rw-r--r--tests/auto/client/mockinput.cpp31
-rw-r--r--tests/auto/client/mockinput.h25
4 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/client/mockcompositor.cpp b/tests/auto/client/mockcompositor.cpp
index 70fa5f23..cb0e6576 100644
--- a/tests/auto/client/mockcompositor.cpp
+++ b/tests/auto/client/mockcompositor.cpp
@@ -209,6 +209,8 @@ Compositor::Compositor()
wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor);
+ m_data_device_manager.reset(new DataDeviceManager(this, m_display));
+
wl_display_init_shm(m_display);
m_seat.reset(new Seat(this, m_display));
diff --git a/tests/auto/client/mockcompositor.h b/tests/auto/client/mockcompositor.h
index 7f3e2268..03d3a96a 100644
--- a/tests/auto/client/mockcompositor.h
+++ b/tests/auto/client/mockcompositor.h
@@ -61,6 +61,7 @@ typedef void (**Implementation)(void);
class Keyboard;
class Pointer;
class Seat;
+class DataDeviceManager;
class Surface;
class Compositor
@@ -111,6 +112,7 @@ private:
QScopedPointer<Seat> m_seat;
Pointer *m_pointer;
Keyboard *m_keyboard;
+ QScopedPointer<DataDeviceManager> m_data_device_manager;
QVector<Surface *> m_surfaces;
};
diff --git a/tests/auto/client/mockinput.cpp b/tests/auto/client/mockinput.cpp
index bd85ad6c..fbe44de4 100644
--- a/tests/auto/client/mockinput.cpp
+++ b/tests/auto/client/mockinput.cpp
@@ -227,4 +227,35 @@ void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource)
m_focusResource = 0;
}
+DataDevice::DataDevice(Compositor *compositor)
+ : wl_data_device()
+ , m_compositor(compositor)
+{
+
+}
+
+DataDevice::~DataDevice()
+{
+
+}
+
+DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display)
+ : wl_data_device_manager(display)
+ , m_compositor(compositor)
+{
+
+}
+
+DataDeviceManager::~DataDeviceManager()
+{
+
+}
+
+void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat)
+{
+ if (!m_data_device)
+ m_data_device.reset(new DataDevice(m_compositor));
+ m_data_device->add(resource->client(), id);
+}
+
}
diff --git a/tests/auto/client/mockinput.h b/tests/auto/client/mockinput.h
index 128758ca..16b19b4f 100644
--- a/tests/auto/client/mockinput.h
+++ b/tests/auto/client/mockinput.h
@@ -120,6 +120,31 @@ private:
Surface *m_focus;
};
+class DataDevice : public QtWaylandServer::wl_data_device
+{
+public:
+ DataDevice(Compositor *compositor);
+ ~DataDevice();
+
+private:
+ Compositor *m_compositor;
+};
+
+class DataDeviceManager : public QtWaylandServer::wl_data_device_manager
+{
+public:
+ DataDeviceManager(Compositor *compositor, struct ::wl_display *display);
+ ~DataDeviceManager();
+
+protected:
+ void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE;
+
+private:
+ Compositor *m_compositor;
+
+ QScopedPointer<DataDevice> m_data_device;
+};
+
}
#endif // MOCKINPUT_H