From 9f4f713e5254c0615eda4ab86975d236c246ddec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 13 May 2013 09:25:18 +0200 Subject: [PATCH] Remove mocked getStringProperty for test_client_machine Utils has an xcb variant nowadays, so let's use that and get it under unit test at the same time. --- tests/CMakeLists.txt | 3 +++ tests/test_client_machine.cpp | 22 +++------------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2263599142..8075690d4d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,6 +40,9 @@ target_link_libraries( testVirtualDesktops set( testClientMachine_SRCS test_client_machine.cpp ../client_machine.cpp + ../utils.cpp + ../atoms.cpp # needed by utils.cpp + ../cursor.cpp # needed by utils.cpp ) kde4_add_unit_test( testClientMachine TESTNAME kwin-TestClientMachine ${testClientMachine_SRCS} ) diff --git a/tests/test_client_machine.cpp b/tests/test_client_machine.cpp index 3802ce4b34..574e688aff 100644 --- a/tests/test_client_machine.cpp +++ b/tests/test_client_machine.cpp @@ -19,6 +19,7 @@ along with this program. If not, see . *********************************************************************/ #include "testutils.h" // KWin +#include "../atoms.h" // needed for utils to compile #include "../client_machine.h" #include "../utils.h" #include "../xcbutils.h" @@ -34,25 +35,8 @@ along with this program. If not, see . #include namespace KWin { - -// mock required function from utils -QByteArray getStringProperty(xcb_window_t w, xcb_atom_t prop, char separator) -{ - Q_UNUSED(separator) - ScopedCPointer property(xcb_get_property_reply(connection(), - xcb_get_property_unchecked(connection(), false, w, prop, XCB_ATOM_STRING, 0, 10000), - NULL)); - if (property.isNull()) { - return QByteArray(); - } - void *data = xcb_get_property_value(property.data()); - if (data && property->value_len > 0) { - QByteArray result = QByteArray((const char*) data, property->value_len); - return result; - } - return QByteArray(); -} - +// just to make the linker of utils happy +Atoms* atoms; } using namespace KWin;