Changeset 97283 in vbox for trunk/src/VBox
- Timestamp:
- Oct 24, 2022 4:27:51 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardMockHGCM.cpp
r97275 r97283 32 32 #ifdef RT_OS_LINUX 33 33 # include <VBox/GuestHost/SharedClipboard-x11.h> 34 #endif 35 #ifdef RT_OS_WINDOWS 36 # include <VBox/GuestHost/SharedClipboard-win.h> 34 37 #endif 35 38 … … 458 461 { 459 462 case VBOX_SHCL_FMT_UNICODETEXT: 463 #ifndef RT_OS_WINDOWS /** @todo Not sure about OS/2. */ 460 464 cbToRead *= sizeof(RTUTF16); 465 #endif 461 466 break; 462 467 … … 501 506 if (cbRead == cbToRead) 502 507 { 503 PRTUTF16 pwszSrc; 508 #ifndef RT_OS_WINDOWS /** @todo Not sure about OS/2. */ 509 PRTUTF16 pwszSrc = NULL; 504 510 RTTEST_CHECK(g_hTest, RT_SUCCESS(RTStrToUtf16((const char *)pTask->pvData, &pwszSrc))); 505 511 RTTEST_CHECK_MSG(g_hTest, memcmp(pwszSrc, pabDst, cbRead) == 0, (g_hTest, "Read data does not match host data\n")); 506 512 RTUtf16Free(pwszSrc); 513 #else 514 RTTEST_CHECK_MSG(g_hTest, memcmp(pTask->pvData, pabDst, cbRead) == 0, (g_hTest, "Read data does not match host data\n")); 515 #endif 507 516 } 508 517 … … 553 562 { 554 563 RT_NOREF(ppvCtx); 555 556 #if defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS)557 /* Initialize the Shared Clipboard backend callbacks. */558 PSHCLBACKEND pBackend = ShClSvcGetBackend();559 560 SHCLCALLBACKS ShClCallbacks;561 RT_ZERO(ShClCallbacks);562 ShClCallbacks.pfnReportFormats = tstTestReadFromHost_ReportFormatsCallback;563 ShClCallbacks.pfnOnClipboardRead = tstTestReadFromHost_OnClipboardReadCallback;564 ShClBackendSetCallbacks(pBackend, &ShClCallbacks);565 #endif /* defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS) */566 564 567 565 /* Set the right clipboard mode, so that the guest can read from the host. */ … … 585 583 pTask->cbData++; /* Add terminating zero. */ 586 584 #else 587 pTask->pvData = tstGenerateUtf16StringA((uint32_t)(pTask->cbData / sizeof(RTUTF16))); 585 pTask->pvData = tstGenerateUtf16StringA((uint32_t)(pTask->cbData /* We use bytes == chars here */)); 586 pTask->cbData *= sizeof(RTUTF16); 588 587 pTask->cbData += sizeof(RTUTF16); /* Add terminating zero. */ 589 588 #endif 590 589 pTask->cbProcessed = 0; 591 590 591 int rc = VINF_SUCCESS; 592 593 #if defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS) 594 /* Initialize the Shared Clipboard backend callbacks. */ 595 PSHCLBACKEND pBackend = ShClSvcGetBackend(); 596 597 SHCLCALLBACKS ShClCallbacks; 598 RT_ZERO(ShClCallbacks); 599 ShClCallbacks.pfnReportFormats = tstTestReadFromHost_ReportFormatsCallback; 600 ShClCallbacks.pfnOnClipboardRead = tstTestReadFromHost_OnClipboardReadCallback; 601 ShClBackendSetCallbacks(pBackend, &ShClCallbacks); 602 #elif defined (RT_OS_WINDOWS) 603 rc = SharedClipboardWinOpen(GetDesktopWindow()); 604 if (RT_SUCCESS(rc)) 605 { 606 rc = SharedClipboardWinDataWrite(CF_UNICODETEXT, pTask->pvData, (uint32_t)pTask->cbData); 607 SharedClipboardWinClose(); 608 } 609 #endif /* defined (RT_OS_LINUX) || defined (RT_OS_SOLARIS) */ 610 592 611 RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Host data (%RU32):\n%.*Rhxd\n", pTask->cbData, pTask->cbData, pTask->pvData); 593 return VINF_SUCCESS;612 return rc; 594 613 } 595 614
Note:
See TracChangeset
for help on using the changeset viewer.