VirtualBox

source: vbox/trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11Smoke.cpp@ 88603

Last change on this file since 88603 was 87568, checked in by vboxsync, 4 years ago

Shared Clipboard: doxygen fixes for unnecessary @copydoc in definitions and duplicate @param docs [build fix]. (probably ​bugref:9437)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: tstClipboardGH-X11Smoke.cpp 87568 2021-02-03 14:31:27Z vboxsync $ */
2/** @file
3 * Shared Clipboard guest/host X11 code smoke tests.
4 */
5
6/*
7 * Copyright (C) 2011-2020 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/* This is a simple test case that just starts a copy of the X11 clipboard
19 * backend, checks the X11 clipboard and exits. If ever needed I will add an
20 * interactive mode in which the user can read and copy to the clipboard from
21 * the command line. */
22
23#include <iprt/assert.h>
24#include <iprt/env.h>
25#include <iprt/err.h>
26#include <iprt/test.h>
27
28#include <VBox/GuestHost/SharedClipboard.h>
29#include <VBox/GuestHost/SharedClipboard-x11.h>
30#include <VBox/GuestHost/clipboard-helper.h>
31
32
33DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb)
34{
35 RT_NOREF(pCtx, uFmt, ppv, pcb);
36 return VERR_NO_DATA;
37}
38
39DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS fFormats)
40{
41 RT_NOREF(pCtx, fFormats);
42}
43
44DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rcCompletion,
45 CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
46{
47 RT_NOREF(pCtx, rcCompletion, pReq, pv, cb);
48}
49
50int main()
51{
52 /*
53 * Init the runtime, test and say hello.
54 */
55 RTTEST hTest;
56 int rc = RTTestInitAndCreate("tstClipboardGH-X11Smoke", &hTest);
57 if (rc)
58 return rc;
59 RTTestBanner(hTest);
60
61 /*
62 * Run the test.
63 */
64 rc = VINF_SUCCESS;
65 /* We can't test anything without an X session, so just return success
66 * in that case. */
67 if (!RTEnvExist("DISPLAY"))
68 {
69 RTTestPrintf(hTest, RTTESTLVL_INFO,
70 "X11 not available, not running test\n");
71 return RTTestSummaryAndDestroy(hTest);
72 }
73 SHCLX11CTX X11Ctx;
74 rc = ShClX11Init(&X11Ctx, NULL, false);
75 AssertRCReturn(rc, 1);
76 rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */);
77 AssertRCReturn(rc, 1);
78 /* Give the clipboard time to synchronise. */
79 RTThreadSleep(500);
80 rc = ShClX11ThreadStop(&X11Ctx);
81 AssertRCReturn(rc, 1);
82 ShClX11Destroy(&X11Ctx);
83 return RTTestSummaryAndDestroy(hTest);
84}
85
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