[Xcb::Wrapper] Add unit test for CurrentInput
This commit is contained in:
parent
9db9f172bc
commit
e25abdf3bb
1 changed files with 21 additions and 0 deletions
|
@ -45,6 +45,7 @@ private Q_SLOTS:
|
|||
void assignmentAfterRetrieve();
|
||||
void discard();
|
||||
void testQueryTree();
|
||||
void testCurrentInput();
|
||||
private:
|
||||
void testEmpty(WindowGeometry &geometry);
|
||||
void testGeometry(WindowGeometry &geometry, const QRect &rect);
|
||||
|
@ -244,5 +245,25 @@ void TestXcbWrapper::testQueryTree()
|
|||
QVERIFY(doesntExist.isRetrieved());
|
||||
}
|
||||
|
||||
void TestXcbWrapper::testCurrentInput()
|
||||
{
|
||||
m_testWindow = createWindow();
|
||||
xcb_connection_t *c = QX11Info::connection();
|
||||
xcb_map_window(c, m_testWindow);
|
||||
QX11Info::setAppTime(QX11Info::getTimestamp());
|
||||
|
||||
// let's set the input focus
|
||||
xcb_set_input_focus(c, XCB_INPUT_FOCUS_PARENT, m_testWindow, QX11Info::appTime());
|
||||
xcb_flush(c);
|
||||
|
||||
CurrentInput input;
|
||||
QCOMPARE(input.window(), m_testWindow);
|
||||
|
||||
// creating a copy should make the input object have no window any more
|
||||
CurrentInput input2(input);
|
||||
QCOMPARE(input2.window(), m_testWindow);
|
||||
QCOMPARE(input.window(), xcb_window_t(XCB_WINDOW_NONE));
|
||||
}
|
||||
|
||||
KWIN_TEST_MAIN(TestXcbWrapper)
|
||||
#include "test_xcb_wrapper.moc"
|
||||
|
|
Loading…
Reference in a new issue