[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] autotests: [Xcb::Wrapper] Add unit test for TransientFor
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2014-04-17 5:47:35
Message-ID: E1WafAd-0006wd-5L () scm ! kde ! org
[Download RAW message or body]

Git commit 98f259d63ed3c08ca4b6aafc49023576730222bf by Martin Gräßlin.
Committed on 14/04/2014 at 09:12.
Pushed by graesslin into branch 'master'.

[Xcb::Wrapper] Add unit test for TransientFor

M  +25   -0    autotests/test_xcb_wrapper.cpp

http://commits.kde.org/kwin/98f259d63ed3c08ca4b6aafc49023576730222bf

diff --git a/autotests/test_xcb_wrapper.cpp b/autotests/test_xcb_wrapper.cpp
index a13f351..769cd17 100644
--- a/autotests/test_xcb_wrapper.cpp
+++ b/autotests/test_xcb_wrapper.cpp
@@ -46,6 +46,7 @@ private Q_SLOTS:
     void discard();
     void testQueryTree();
     void testCurrentInput();
+    void testTransientFor();
 private:
     void testEmpty(WindowGeometry &geometry);
     void testGeometry(WindowGeometry &geometry, const QRect &rect);
@@ -265,5 +266,29 @@ void TestXcbWrapper::testCurrentInput()
     QCOMPARE(input.window(), xcb_window_t(XCB_WINDOW_NONE));
 }
 
+void TestXcbWrapper::testTransientFor()
+{
+    m_testWindow = createWindow();
+    TransientFor transient(m_testWindow);
+    QCOMPARE(transient.window(), m_testWindow);
+    // our m_testWindow doesn't have a transient for hint
+    xcb_window_t compareWindow = XCB_WINDOW_NONE;
+    QVERIFY(!transient.getTransientFor(&compareWindow));
+    QCOMPARE(compareWindow, xcb_window_t(XCB_WINDOW_NONE));
+
+    // Create a Window with a transient for hint
+    Window transientWindow(createWindow());
+    transientWindow.changeProperty(XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, 1, &m_testWindow);
+
+    // let's get another transient object
+    TransientFor realTransient(transientWindow);
+    QVERIFY(realTransient.getTransientFor(&compareWindow));
+    QCOMPARE(compareWindow, m_testWindow);
+
+    // test for a not existing window
+    TransientFor doesntExist(XCB_WINDOW_NONE);
+    QVERIFY(!doesntExist.getTransientFor(&compareWindow));
+}
+
 KWIN_TEST_MAIN(TestXcbWrapper)
 #include "test_xcb_wrapper.moc"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic