VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp@ 50337

Last change on this file since 50337 was 50337, checked in by vboxsync, 11 years ago

Additions/x11/VBoxClient: more clean-up.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.7 KB
Line 
1/** @file
2 * Automated test of the X11 seamless Additions code.
3 * @todo Better separate test data from implementation details!
4 */
5
6/*
7 * Copyright (C) 2007-2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include <stdlib.h> /* exit() */
19
20#include <X11/Xatom.h>
21#include <X11/Xmu/WinUtil.h>
22
23#include <iprt/initterm.h>
24#include <iprt/mem.h>
25#include <iprt/path.h>
26#include <iprt/semaphore.h>
27#include <iprt/stream.h>
28#include <iprt/string.h>
29
30#include "../seamless.h"
31
32#undef DefaultRootWindow
33
34/******************************************************
35* Mock X11 functions needed by the seamless X11 class *
36******************************************************/
37
38int XFree(void *data)
39{
40 RTMemFree(data);
41 return 0;
42}
43
44#define TEST_DISPLAY ((Display *)0xffff)
45#define TEST_ROOT ((Window)1)
46
47extern "C" Display *XOpenDisplay(const char *display_name);
48Display *XOpenDisplay(const char *display_name)
49{
50 return TEST_DISPLAY;
51}
52
53extern "C" int XCloseDisplay(Display *display);
54int XCloseDisplay(Display *display)
55{
56 Assert(display == TEST_DISPLAY);
57 return 0;
58}
59
60enum
61{
62 ATOM_PROP = 1,
63 ATOM_DESKTOP_PROP
64};
65
66extern "C" Atom XInternAtom(Display *display, const char *atom_name,
67 Bool only_if_exists);
68Atom XInternAtom(Display *display, const char *atom_name, Bool only_if_exists)
69{
70 Assert(display == TEST_DISPLAY);
71 if (!RTStrCmp(atom_name, WM_TYPE_PROP))
72 return (Atom) ATOM_PROP;
73 if (!RTStrCmp(atom_name, WM_TYPE_DESKTOP_PROP))
74 return (Atom) ATOM_DESKTOP_PROP;
75 AssertFailed();
76 return (Atom)0;
77}
78
79/** The window (if any) on which the WM_TYPE_PROP property is set to the
80 * WM_TYPE_DESKTOP_PROP atom. */
81static Window g_hSmlsDesktopWindow = 0;
82
83extern "C" int XGetWindowProperty(Display *display, Window w, Atom property,
84 long long_offset, long long_length,
85 Bool delProp, Atom req_type,
86 Atom *actual_type_return,
87 int *actual_format_return,
88 unsigned long *nitems_return,
89 unsigned long *bytes_after_return,
90 unsigned char **prop_return);
91int XGetWindowProperty(Display *display, Window w, Atom property,
92 long long_offset, long long_length, Bool delProp,
93 Atom req_type, Atom *actual_type_return,
94 int *actual_format_return,
95 unsigned long *nitems_return,
96 unsigned long *bytes_after_return,
97 unsigned char **prop_return)
98{
99 Assert(display == TEST_DISPLAY);
100 Atom atomType = XInternAtom (display, WM_TYPE_PROP, true);
101 Atom atomTypeDesktop = XInternAtom (display, WM_TYPE_DESKTOP_PROP, true);
102 /* We only handle things we expect. */
103 AssertReturn((req_type == XA_ATOM) || (req_type == AnyPropertyType),
104 0xffff);
105 AssertReturn(property == atomType, 0xffff);
106 *actual_type_return = XA_ATOM;
107 *actual_format_return = sizeof(Atom) * 8;
108 *nitems_return = 0;
109 *bytes_after_return = sizeof(Atom);
110 *prop_return = NULL;
111 if ((w != g_hSmlsDesktopWindow) || (g_hSmlsDesktopWindow == 0))
112 return Success;
113 AssertReturn(long_offset == 0, 0);
114 AssertReturn(delProp == false, 0);
115 unsigned char *pProp;
116 pProp = (unsigned char *)RTMemDup(&atomTypeDesktop,
117 sizeof(atomTypeDesktop));
118 AssertReturn(pProp, 0xffff);
119 *nitems_return = 1;
120 *prop_return = pProp;
121 *bytes_after_return = 0;
122 return 0;
123}
124
125/** Sets the current set of properties for all mock X11 windows */
126static void smlsSetDesktopWindow(Window hWin)
127{
128 g_hSmlsDesktopWindow = hWin;
129}
130
131extern "C" Bool XShapeQueryExtension (Display *dpy, int *event_basep,
132 int *error_basep);
133Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
134{
135 Assert(dpy == TEST_DISPLAY);
136 return true;
137}
138
139/* We silently ignore this for now. */
140extern "C" int XSelectInput(Display *display, Window w, long event_mask);
141int XSelectInput(Display *display, Window w, long event_mask)
142{
143 Assert(display == TEST_DISPLAY);
144 return 0;
145}
146
147/* We silently ignore this for now. */
148extern "C" void XShapeSelectInput(Display *display, Window w,
149 unsigned long event_mask);
150void XShapeSelectInput(Display *display, Window w, unsigned long event_mask)
151{
152 Assert(display == TEST_DISPLAY);
153}
154
155extern "C" Window XDefaultRootWindow(Display *display);
156Window XDefaultRootWindow(Display *display)
157{
158 Assert(display == TEST_DISPLAY);
159 return TEST_ROOT;
160}
161
162static unsigned g_cSmlsWindows = 0;
163static Window *g_paSmlsWindows = NULL;
164static XWindowAttributes *g_paSmlsWinAttribs = NULL;
165static const char **g_papszSmlsWinNames = NULL;
166
167extern "C" Status XQueryTree(Display *display, Window w, Window *root_return,
168 Window *parent_return, Window **children_return,
169 unsigned int *nchildren_return);
170Status XQueryTree(Display *display, Window w, Window *root_return,
171 Window *parent_return, Window **children_return,
172 unsigned int *nchildren_return)
173{
174 Assert(display == TEST_DISPLAY);
175 AssertReturn(w == TEST_ROOT, False); /* We support nothing else */
176 AssertPtrReturn(children_return, False);
177 AssertReturn(g_paSmlsWindows, False);
178 if (root_return)
179 *root_return = TEST_ROOT;
180 if (parent_return)
181 *parent_return = TEST_ROOT;
182 *children_return = (Window *)RTMemDup(g_paSmlsWindows,
183 g_cSmlsWindows * sizeof(Window));
184 if (nchildren_return)
185 *nchildren_return = g_cSmlsWindows;
186 return (g_cSmlsWindows != 0);
187}
188
189extern "C" Window XmuClientWindow(Display *dpy, Window win);
190Window XmuClientWindow(Display *dpy, Window win)
191{
192 Assert(dpy == TEST_DISPLAY);
193 return win;
194}
195
196extern "C" Status XGetWindowAttributes(Display *display, Window w,
197 XWindowAttributes *window_attributes_return);
198Status XGetWindowAttributes(Display *display, Window w,
199 XWindowAttributes *window_attributes_return)
200{
201 Assert(display == TEST_DISPLAY);
202 AssertPtrReturn(window_attributes_return, 1);
203 for (unsigned i = 0; i < g_cSmlsWindows; ++i)
204 if (g_paSmlsWindows[i] == w)
205 {
206 *window_attributes_return = g_paSmlsWinAttribs[i];
207 return 1;
208 }
209 return 0;
210}
211
212extern "C" Status XGetWMNormalHints(Display *display, Window w,
213 XSizeHints *hints_return,
214 long *supplied_return);
215
216Status XGetWMNormalHints(Display *display, Window w,
217 XSizeHints *hints_return, long *supplied_return)
218{
219 Assert(display == TEST_DISPLAY);
220 return 1;
221}
222
223static void smlsSetWindowAttributes(XWindowAttributes *pAttribs,
224 Window *pWindows, unsigned cAttribs,
225 const char **paNames)
226{
227 g_paSmlsWinAttribs = pAttribs;
228 g_paSmlsWindows = pWindows;
229 g_cSmlsWindows = cAttribs;
230 g_papszSmlsWinNames = paNames;
231}
232
233static Window g_SmlsShapedWindow = 0;
234static int g_cSmlsShapeRectangles = 0;
235static XRectangle *g_pSmlsShapeRectangles = NULL;
236
237extern "C" XRectangle *XShapeGetRectangles (Display *dpy, Window window,
238 int kind, int *count,
239 int *ordering);
240XRectangle *XShapeGetRectangles (Display *dpy, Window window, int kind,
241 int *count, int *ordering)
242{
243 Assert(dpy == TEST_DISPLAY);
244 if ((window != g_SmlsShapedWindow) || (window == 0))
245 return NULL; /* Probably not correct, but works for us. */
246 *count = g_cSmlsShapeRectangles;
247 *ordering = 0;
248 return (XRectangle *)RTMemDup(g_pSmlsShapeRectangles,
249 sizeof(XRectangle)
250 * g_cSmlsShapeRectangles);
251}
252
253static void smlsSetShapeRectangles(Window window, int cRects,
254 XRectangle *pRects)
255{
256 g_SmlsShapedWindow = window;
257 g_cSmlsShapeRectangles = cRects;
258 g_pSmlsShapeRectangles = pRects;
259}
260
261static int g_SmlsEventType = 0;
262static Window g_SmlsEventWindow = 0;
263
264/* This should not be needed in the bits of the code we test. */
265extern "C" int XNextEvent(Display *display, XEvent *event_return);
266int XNextEvent(Display *display, XEvent *event_return)
267{
268 Assert(display == TEST_DISPLAY);
269 event_return->xany.type = g_SmlsEventType;
270 event_return->xany.window = g_SmlsEventWindow;
271 event_return->xmap.window = g_SmlsEventWindow;
272 return True;
273}
274
275static void smlsSetNextEvent(int type, Window window)
276{
277 g_SmlsEventType = type;
278 g_SmlsEventWindow = window;
279}
280
281/* This should not be needed in the bits of the code we test. */
282extern "C" Status XSendEvent(Display *display, Window w, Bool propagate,
283 long event_mask, XEvent *event_send);
284Status XSendEvent(Display *display, Window w, Bool propagate,
285 long event_mask, XEvent *event_send)
286{
287 Assert(display == TEST_DISPLAY);
288 AssertFailedReturn(0);
289}
290
291/* This should not be needed in the bits of the code we test. */
292extern "C" int XFlush(Display *display);
293int XFlush(Display *display)
294{
295 Assert(display == TEST_DISPLAY);
296 AssertFailedReturn(0);
297}
298
299/** Dummy host class */
300class testHost: public SeamlessHostProxy
301{
302 bool mfNotified;
303public:
304 testHost() : mfNotified(false) {}
305 virtual void notify(RTRECT *pRects, size_t cRects)
306 {
307 mfNotified = true;
308 }
309 virtual ~testHost() {}
310 bool isNotified(void) { return mfNotified; }
311};
312
313/*****************************
314* The actual tests to be run *
315*****************************/
316
317/** The name of the unit test */
318static const char *g_pszTestName = NULL;
319
320/*** Test fixture data and data structures ***/
321
322/** A structure describing a test fixture to be run through. Each fixture
323 * describes the state of the windows visible (and unmapped) on the X server
324 * before and after a particular event is delivered, and the expected
325 * on-screen positions of all interesting visible windows at the end of the
326 * fixture as reported by the code (currently in the order it is likely to
327 * report them in, @todo sort this). We expect that the set of visible
328 * windows will be the same whether we start the code before the event and
329 * handle it or start the code after the event.
330 */
331struct SMLSFIXTURE
332{
333 /** The number of windows visible before the event */
334 unsigned cWindowsBefore;
335 /** An array of Window IDs for the visible and unmapped windows before
336 * the event */
337 Window *pahWindowsBefore;
338 /** The window attributes matching the windows in @a paWindowsBefore */
339 XWindowAttributes *paAttribsBefore;
340 /** The window names matching the windows in @a paWindowsBefore */
341 const char **papszNamesBefore;
342 /** The shaped window before the event - we allow at most one of these.
343 * Zero for none. */
344 Window hShapeWindowBefore;
345 /** The number of rectangles in the shaped window before the event. */
346 int cShapeRectsBefore;
347 /** The rectangles in the shaped window before the event */
348 XRectangle *paShapeRectsBefore;
349 /** The number of windows visible after the event */
350 unsigned cWindowsAfter;
351 /** An array of Window IDs for the visible and unmapped windows after
352 * the event */
353 Window *pahWindowsAfter;
354 /** The window attributes matching the windows in @a paWindowsAfter */
355 XWindowAttributes *paAttribsAfter;
356 /** The window names matching the windows in @a paWindowsAfter */
357 const char **papszNamesAfter;
358 /** The shaped window after the event - we allow at most one of these.
359 * Zero for none. */
360 Window hShapeWindowAfter;
361 /** The number of rectangles in the shaped window after the event. */
362 int cShapeRectsAfter;
363 /** The rectangles in the shaped window after the event */
364 XRectangle *paShapeRectsAfter;
365 /** The event to delivered */
366 int x11EventType;
367 /** The window for which the event in @enmEvent is delivered */
368 Window hEventWindow;
369 /** The number of windows expected to be reported at the end of the
370 * fixture */
371 unsigned cReportedRects;
372 /** The onscreen positions of those windows. */
373 RTRECT *paReportedRects;
374};
375
376/*** Test fixture to test the code against X11 configure (move) events ***/
377
378static Window g_ahWin1[] = { 20 };
379static XWindowAttributes g_aAttrib1Before[] =
380{ { 100, 200, 200, 300, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IsViewable }
381};
382static XRectangle g_aRectangle1[] =
383{
384 { 0, 0, 50, 50 },
385 { 50, 50, 150, 250 }
386};
387static XWindowAttributes g_aAttrib1After[] =
388{ { 200, 300, 200, 300, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IsViewable }
389};
390static const char *g_apszNames1[] = { "Test Window" };
391
392AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib1Before));
393AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib1After));
394AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_apszNames1));
395
396static RTRECT g_aRects1[] =
397{
398 { 200, 300, 250, 350 },
399 { 250, 350, 400, 600 }
400};
401
402static SMLSFIXTURE g_testMove =
403{
404 RT_ELEMENTS(g_ahWin1),
405 g_ahWin1,
406 g_aAttrib1Before,
407 g_apszNames1,
408 20,
409 RT_ELEMENTS(g_aRectangle1),
410 g_aRectangle1,
411 RT_ELEMENTS(g_ahWin1),
412 g_ahWin1,
413 g_aAttrib1After,
414 g_apszNames1,
415 20,
416 RT_ELEMENTS(g_aRectangle1),
417 g_aRectangle1,
418 ConfigureNotify,
419 20,
420 RT_ELEMENTS(g_aRects1),
421 g_aRects1
422};
423
424/*** Test fixture to test the code against X11 configure (resize) events ***/
425
426static XWindowAttributes g_aAttrib2Before[] =
427{ { 100, 200, 200, 300, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IsViewable }
428};
429static XRectangle g_aRectangle2Before[] =
430{
431 { 0, 0, 50, 50 },
432 { 50, 50, 100, 100 }
433};
434
435AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib2Before));
436
437static SMLSFIXTURE g_testResize =
438{
439 RT_ELEMENTS(g_ahWin1),
440 g_ahWin1,
441 g_aAttrib2Before,
442 g_apszNames1,
443 20,
444 RT_ELEMENTS(g_aRectangle2Before),
445 g_aRectangle2Before,
446 RT_ELEMENTS(g_ahWin1),
447 g_ahWin1,
448 g_aAttrib1After,
449 g_apszNames1,
450 20,
451 RT_ELEMENTS(g_aRectangle1),
452 g_aRectangle1,
453 ConfigureNotify,
454 20,
455 RT_ELEMENTS(g_aRects1),
456 g_aRects1
457};
458
459/*** Test fixture to test the code against X11 map events ***/
460
461static XWindowAttributes g_aAttrib3Before[] =
462{ { 200, 300, 200, 300, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IsUnmapped }
463};
464
465AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib3Before));
466
467static SMLSFIXTURE g_testMap =
468{
469 RT_ELEMENTS(g_ahWin1),
470 g_ahWin1,
471 g_aAttrib3Before,
472 g_apszNames1,
473 20,
474 RT_ELEMENTS(g_aRectangle1),
475 g_aRectangle1,
476 RT_ELEMENTS(g_ahWin1),
477 g_ahWin1,
478 g_aAttrib1After,
479 g_apszNames1,
480 20,
481 RT_ELEMENTS(g_aRectangle1),
482 g_aRectangle1,
483 MapNotify,
484 20,
485 RT_ELEMENTS(g_aRects1),
486 g_aRects1
487};
488
489/*** Test fixtures to test the code against X11 unmap events ***/
490
491static XWindowAttributes g_aAttrib4After[] =
492{ { 100, 200, 300, 400, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, IsUnmapped }
493};
494
495AssertCompile(RT_ELEMENTS(g_ahWin1) == RT_ELEMENTS(g_aAttrib4After));
496
497static SMLSFIXTURE g_testUnmap =
498{
499 RT_ELEMENTS(g_ahWin1),
500 g_ahWin1,
501 g_aAttrib1Before,
502 g_apszNames1,
503 20,
504 RT_ELEMENTS(g_aRectangle1),
505 g_aRectangle1,
506 RT_ELEMENTS(g_ahWin1),
507 g_ahWin1,
508 g_aAttrib4After,
509 g_apszNames1,
510 20,
511 RT_ELEMENTS(g_aRectangle1),
512 g_aRectangle1,
513 UnmapNotify,
514 20,
515 0,
516 NULL
517};
518
519/*** A window we are not monitoring has been unmapped. Nothing should
520 *** happen, especially nothing bad. ***/
521
522static RTRECT g_aRects2[] =
523{
524 { 100, 200, 150, 250 },
525 { 150, 250, 300, 500 }
526};
527
528static SMLSFIXTURE g_testUnmapOther =
529{
530 RT_ELEMENTS(g_ahWin1),
531 g_ahWin1,
532 g_aAttrib1Before,
533 g_apszNames1,
534 20,
535 RT_ELEMENTS(g_aRectangle1),
536 g_aRectangle1,
537 RT_ELEMENTS(g_ahWin1),
538 g_ahWin1,
539 g_aAttrib1Before,
540 g_apszNames1,
541 20,
542 RT_ELEMENTS(g_aRectangle1),
543 g_aRectangle1,
544 UnmapNotify,
545 21,
546 RT_ELEMENTS(g_aRects2),
547 g_aRects2
548};
549
550/*** Test fixture to test the code against X11 shape events ***/
551
552static XRectangle g_aRectangle5Before[] =
553{
554 { 0, 0, 200, 200 }
555};
556
557static SMLSFIXTURE g_testShape =
558{
559 RT_ELEMENTS(g_ahWin1),
560 g_ahWin1,
561 g_aAttrib1After,
562 g_apszNames1,
563 20,
564 RT_ELEMENTS(g_aRectangle5Before),
565 g_aRectangle5Before,
566 RT_ELEMENTS(g_ahWin1),
567 g_ahWin1,
568 g_aAttrib1After,
569 g_apszNames1,
570 20,
571 RT_ELEMENTS(g_aRectangle1),
572 g_aRectangle1,
573 VBoxShapeNotify,
574 20,
575 RT_ELEMENTS(g_aRects1),
576 g_aRects1
577};
578
579/*** And the test code proper ***/
580
581/** Compare two RTRECT structures */
582static bool smlsCompRect(RTRECT *pFirst, RTRECT *pSecond)
583{
584 return ( (pFirst->xLeft == pSecond->xLeft)
585 && (pFirst->yTop == pSecond->yTop)
586 && (pFirst->xRight == pSecond->xRight)
587 && (pFirst->yBottom == pSecond->yBottom));
588}
589
590static void smlsPrintDiffRects(RTRECT *pExp, RTRECT *pGot)
591{
592 RTPrintf(" Expected: %d, %d, %d, %d. Got: %d, %d, %d, %d\n",
593 pExp->xLeft, pExp->yTop, pExp->xRight, pExp->yBottom,
594 pGot->xLeft, pGot->yTop, pGot->xRight, pGot->yBottom);
595}
596
597/** Run through a test fixture */
598static unsigned smlsDoFixture(SMLSFIXTURE *pFixture, const char *pszDesc)
599{
600 VBoxGuestSeamlessX11 subject;
601 testHost host;
602 unsigned cErrs = 0;
603
604 subject.init(&host);
605 smlsSetWindowAttributes(pFixture->paAttribsBefore,
606 pFixture->pahWindowsBefore,
607 pFixture->cWindowsBefore,
608 pFixture->papszNamesBefore);
609 smlsSetShapeRectangles(pFixture->hShapeWindowBefore,
610 pFixture->cShapeRectsBefore,
611 pFixture->paShapeRectsBefore);
612 subject.start();
613 smlsSetWindowAttributes(pFixture->paAttribsAfter,
614 pFixture->pahWindowsAfter,
615 pFixture->cWindowsAfter,
616 pFixture->papszNamesAfter);
617 smlsSetShapeRectangles(pFixture->hShapeWindowAfter,
618 pFixture->cShapeRectsAfter,
619 pFixture->paShapeRectsAfter);
620 smlsSetNextEvent(pFixture->x11EventType, pFixture->hEventWindow);
621 if (host.isNotified()) /* Initial window tree rebuild */
622 {
623 RTPrintf("%s: fixture: %s. Notification was set before the first event!!!\n",
624 g_pszTestName, pszDesc);
625 ++cErrs;
626 }
627 subject.nextEvent();
628 if (!host.isNotified())
629 {
630 RTPrintf("%s: fixture: %s. No notification was sent for the initial window tree rebuild.\n",
631 g_pszTestName, pszDesc);
632 ++cErrs;
633 }
634 smlsSetNextEvent(0, 0);
635 subject.nextEvent();
636 if (!host.isNotified())
637 {
638 RTPrintf("%s: fixture: %s. No notification was sent after the event.\n",
639 g_pszTestName, pszDesc);
640 ++cErrs;
641 }
642 RTRECT *pRects = subject.getRects();
643 size_t cRects = subject.getRectCount();
644 if (cRects != pFixture->cReportedRects)
645 {
646 RTPrintf("%s: fixture: %s. Wrong number of rectangles reported after processing event (expected %u, got %u).\n",
647 g_pszTestName, pszDesc, pFixture->cReportedRects,
648 cRects);
649 ++cErrs;
650 }
651 else
652 for (unsigned i = 0; i < cRects; ++i)
653 if (!smlsCompRect(&pRects[i], &pFixture->paReportedRects[i]))
654 {
655 RTPrintf("%s: fixture: %s. Rectangle %u wrong after processing event.\n",
656 g_pszTestName, pszDesc, i);
657 smlsPrintDiffRects(&pFixture->paReportedRects[i],
658 &pRects[i]);
659 ++cErrs;
660 break;
661 }
662 subject.stop();
663 subject.start();
664 if (cRects != pFixture->cReportedRects)
665 {
666 RTPrintf("%s: fixture: %s. Wrong number of rectangles reported without processing event (expected %u, got %u).\n",
667 g_pszTestName, pszDesc, pFixture->cReportedRects,
668 cRects);
669 ++cErrs;
670 }
671 else
672 for (unsigned i = 0; i < cRects; ++i)
673 if (!smlsCompRect(&pRects[i], &pFixture->paReportedRects[i]))
674 {
675 RTPrintf("%s: fixture: %s. Rectangle %u wrong without processing event.\n",
676 g_pszTestName, pszDesc, i);
677 smlsPrintDiffRects(&pFixture->paReportedRects[i],
678 &pRects[i]);
679 ++cErrs;
680 break;
681 }
682 return cErrs;
683}
684
685int main( int argc, char **argv)
686{
687 RTR3InitExe(argc, &argv, 0);
688 unsigned cErrs = 0;
689 g_pszTestName = RTPathFilename(argv[0]);
690
691 RTPrintf("%s: TESTING\n", g_pszTestName);
692 cErrs += smlsDoFixture(&g_testMove,
693 "ConfigureNotify event (window moved)");
694 // Currently not working
695 cErrs += smlsDoFixture(&g_testResize,
696 "ConfigureNotify event (window resized)");
697 cErrs += smlsDoFixture(&g_testMap, "MapNotify event");
698 cErrs += smlsDoFixture(&g_testUnmap, "UnmapNotify event");
699 cErrs += smlsDoFixture(&g_testUnmapOther,
700 "UnmapNotify event for unmonitored window");
701 cErrs += smlsDoFixture(&g_testShape, "ShapeNotify event");
702 if (cErrs > 0)
703 RTPrintf("%u errors\n", cErrs);
704 return cErrs == 0 ? 0 : 1;
705}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette