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.
This commit is contained in:
Martin Gräßlin 2013-05-13 09:25:18 +02:00
parent 64e464afe5
commit 9f4f713e52
2 changed files with 6 additions and 19 deletions

View file

@ -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} )

View file

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#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 <http://www.gnu.org/licenses/>.
#include <netdb.h>
namespace KWin {
// mock required function from utils
QByteArray getStringProperty(xcb_window_t w, xcb_atom_t prop, char separator)
{
Q_UNUSED(separator)
ScopedCPointer<xcb_get_property_reply_t> 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;