Changeset 36802 in vbox for trunk/src/VBox/Additions/x11/VBoxClient/testcase
- Timestamp:
- Apr 21, 2011 8:26:25 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
r28800 r36802 247 247 } 248 248 249 static int g_SmlsEventType = 0; 250 static Window g_SmlsEventWindow = 0; 251 249 252 /* This should not be needed in the bits of the code we test. */ 250 253 extern "C" int XNextEvent(Display *display, XEvent *event_return); 251 254 int XNextEvent(Display *display, XEvent *event_return) 252 255 { 253 AssertFailedReturn(0); 256 event_return->xany.type = g_SmlsEventType; 257 event_return->xany.window = g_SmlsEventWindow; 258 event_return->xmap.window = g_SmlsEventWindow; 259 return True; 260 } 261 262 static void smlsSetNextEvent(int type, Window window) 263 { 264 g_SmlsEventType = type; 265 g_SmlsEventWindow = window; 254 266 } 255 267 … … 269 281 AssertFailedReturn(0); 270 282 } 283 284 /** Dummy observer class */ 285 class testObserver: public VBoxGuestSeamlessObserver 286 { 287 bool mfNotified; 288 public: 289 testObserver() : mfNotified(false) {} 290 virtual void notify(void) 291 { 292 mfNotified = true; 293 } 294 virtual ~testObserver() {} 295 bool isNotified(void) { return mfNotified; } 296 }; 271 297 272 298 /***************************** … … 287 313 * windows will be the same whether we start the code before the event and 288 314 * handle it or start the code after the event. 289 *290 * If it is ever needed I could write a small tool to record a fixture on291 * a live guest, but I will put that off as long as I can.292 315 */ 293 316 struct SMLSFIXTURE … … 530 553 { 531 554 VBoxGuestSeamlessX11 subject; 555 testObserver observer; 532 556 unsigned cErrs = 0; 533 557 534 subject.init( NULL);558 subject.init(&observer); 535 559 smlsSetWindowAttributes(pFixture->paAttribsBefore, 536 560 pFixture->pahWindowsBefore, … … 548 572 pFixture->cShapeRectsAfter, 549 573 pFixture->paShapeRectsAfter); 550 switch(pFixture->x11EventType) 574 smlsSetNextEvent(pFixture->x11EventType, pFixture->hEventWindow); 575 if (observer.isNotified()) /* Initial window tree rebuild */ 551 576 { 552 case ConfigureNotify: 553 subject.doConfigureEvent(pFixture->hEventWindow); 554 break; 555 case MapNotify: 556 subject.doMapEvent(pFixture->hEventWindow); 557 break; 558 case UnmapNotify: 559 subject.doUnmapEvent(pFixture->hEventWindow); 560 break; 561 case VBoxShapeNotify: 562 subject.doShapeEvent(pFixture->hEventWindow); 563 break; 564 default: 565 break; 577 RTPrintf("%s: fixture: %s. Notification was set before the first event!!!\n", 578 g_pszTestName, pszDesc); 579 ++cErrs; 580 } 581 subject.nextEvent(); 582 if (!observer.isNotified()) 583 { 584 RTPrintf("%s: fixture: %s. No notification was sent for the initial window tree rebuild.\n", 585 g_pszTestName, pszDesc); 586 ++cErrs; 587 } 588 smlsSetNextEvent(0, 0); 589 subject.nextEvent(); 590 if (!observer.isNotified()) 591 { 592 RTPrintf("%s: fixture: %s. No notification was sent after the event.\n", 593 g_pszTestName, pszDesc); 594 ++cErrs; 566 595 } 567 596 std::auto_ptr<std::vector<RTRECT> > rects = subject.getRects();
Note:
See TracChangeset
for help on using the changeset viewer.