summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2021-02-08 05:24:09 +0200
committerPovilas Kanapickas <povilas@radix.lt>2021-02-15 11:29:58 +0000
commit83f097af344ef361418b18440300107927c0396d (patch)
tree450c6a1c94eb4a7e56fba16420377b4fc53abf46
parent7d3f1e972fb364bac438368eaf7c90e3eed9bd2c (diff)
grab: Simplify code by reusing CreateWindow helper
-rw-r--r--tests/server/grab.cpp85
1 files changed, 10 insertions, 75 deletions
diff --git a/tests/server/grab.cpp b/tests/server/grab.cpp
index 8109f9c..6bfac0a 100644
--- a/tests/server/grab.cpp
+++ b/tests/server/grab.cpp
@@ -91,17 +91,7 @@ TEST_F(PointerGrabTest, ImplicitGrabRawEvents)
::Display *dpy = Display();
- Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
- DisplayWidth(dpy, DefaultScreen(dpy)),
- DisplayHeight(dpy, DefaultScreen(dpy)),
- 0, 0,
- WhitePixel(dpy, DefaultScreen(dpy)));
- XSelectInput(dpy, win, ExposureMask);
- XMapWindow(dpy, win);
- XFlush(dpy);
- ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(Display(),
- Expose,
- -1, -1, 1000));
+ Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
XIEventMask mask;
@@ -189,23 +179,10 @@ TEST_F(PointerGrabTest, DestroyWindowDuringImplicitGrab)
"While the implicit grab is active, destroy the window\n");
::Display *dpy = Display();
- Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
- DisplayWidth(dpy, DefaultScreen(dpy)),
- DisplayHeight(dpy, DefaultScreen(dpy)),
- 0, 0, 0);
- ASSERT_NE(win, (Window)None);
- XSelectInput(dpy, win, StructureNotifyMask|ButtonPressMask|ButtonReleaseMask);
- XMapWindow(dpy, win);
- XSync(dpy, False);
-
- if (xorg::testing::XServer::WaitForEventOfType(dpy, MapNotify, -1, -1)) {
- XEvent ev;
- XNextEvent(dpy, &ev);
- } else {
- ADD_FAILURE() << "Failed waiting for Exposure";
- }
+ Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
- XSync(dpy, True);
+ XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
+ XSync(dpy, False);
Dev(0).ButtonDown(1);
@@ -228,24 +205,10 @@ TEST_F(PointerGrabTest, DestroyClientDuringImplicitGrab)
"While the implicit grab is active, destroy the client\n");
::Display *dpy = Display();
- Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
- DisplayWidth(dpy, DefaultScreen(dpy)),
- DisplayHeight(dpy, DefaultScreen(dpy)),
- 0, 0, 0);
- ASSERT_NE(win, (Window)None);
- XSelectInput(dpy, win, StructureNotifyMask|ButtonPressMask|ButtonReleaseMask);
- XMapWindow(dpy, win);
+ Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
+ XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
XSync(dpy, False);
- if (xorg::testing::XServer::WaitForEventOfType(dpy, MapNotify, -1, -1)) {
- XEvent ev;
- XNextEvent(dpy, &ev);
- } else {
- ADD_FAILURE() << "Failed waiting for Exposure";
- }
-
- XSync(dpy, True);
-
Dev(0).ButtonDown(1);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, ButtonPress, -1, -1));
@@ -266,24 +229,10 @@ TEST_F(PointerGrabTest, ImplicitGrabToActiveGrab)
"Release the button, check event is received\n");
::Display *dpy = Display();
- Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
- DisplayWidth(dpy, DefaultScreen(dpy)),
- DisplayHeight(dpy, DefaultScreen(dpy)),
- 0, 0, 0);
- ASSERT_NE(win, (Window)None);
- XSelectInput(dpy, win, StructureNotifyMask|ButtonPressMask|ButtonReleaseMask);
- XMapWindow(dpy, win);
+ Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
+ XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
XSync(dpy, False);
- if (xorg::testing::XServer::WaitForEventOfType(dpy, MapNotify, -1, -1)) {
- XEvent ev;
- XNextEvent(dpy, &ev);
- } else {
- ADD_FAILURE() << "Failed waiting for Exposure";
- }
-
- XSync(dpy, True);
-
Dev(0).ButtonDown(1);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, ButtonPress, -1, -1));
@@ -308,24 +257,10 @@ TEST_F(PointerGrabTest, ImplicitGrabToActiveGrabDeactivated)
"Release the button\n");
::Display *dpy = Display();
- Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
- DisplayWidth(dpy, DefaultScreen(dpy)),
- DisplayHeight(dpy, DefaultScreen(dpy)),
- 0, 0, 0);
- ASSERT_NE(win, (Window)None);
- XSelectInput(dpy, win, StructureNotifyMask|ButtonPressMask|ButtonReleaseMask);
- XMapWindow(dpy, win);
+ Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
+ XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
XSync(dpy, False);
- if (xorg::testing::XServer::WaitForEventOfType(dpy, MapNotify, -1, -1)) {
- XEvent ev;
- XNextEvent(dpy, &ev);
- } else {
- ADD_FAILURE() << "Failed waiting for Exposure";
- }
-
- XSync(dpy, True);
-
Dev(0).ButtonDown(1);
ASSERT_TRUE(xorg::testing::XServer::WaitForEventOfType(dpy, ButtonPress, -1, -1));