VirtualBox

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

Last change on this file since 86728 was 82911, checked in by vboxsync, 5 years ago

Shared Clipboard/tstClipboardGH-X11Smoke: Logging nit.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: tstClipboardGH-X11Smoke.cpp 82911 2020-01-29 16:54:18Z 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
32DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT Format, void **ppv, uint32_t *pcb)
33{
34 RT_NOREF(pCtx, Format, ppv, pcb);
35 return VERR_NO_DATA;
36}
37
38DECLCALLBACK(void) ShClX11ReportFormatsCallback(PSHCLCONTEXT pCtx, SHCLFORMATS Formats)
39{
40 RT_NOREF(pCtx, Formats);
41}
42
43DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
44{
45 RT_NOREF(pCtx, rc, pReq, pv, cb);
46}
47
48int main()
49{
50 /*
51 * Init the runtime, test and say hello.
52 */
53 RTTEST hTest;
54 int rc = RTTestInitAndCreate("tstClipboardGH-X11Smoke", &hTest);
55 if (rc)
56 return rc;
57 RTTestBanner(hTest);
58
59 /*
60 * Run the test.
61 */
62 rc = VINF_SUCCESS;
63 /* We can't test anything without an X session, so just return success
64 * in that case. */
65 if (!RTEnvExist("DISPLAY"))
66 {
67 RTTestPrintf(hTest, RTTESTLVL_INFO,
68 "X11 not available, not running test\n");
69 return RTTestSummaryAndDestroy(hTest);
70 }
71 SHCLX11CTX X11Ctx;
72 rc = ShClX11Init(&X11Ctx, NULL, false);
73 AssertRCReturn(rc, 1);
74 rc = ShClX11ThreadStart(&X11Ctx, false /* fGrab */);
75 AssertRCReturn(rc, 1);
76 /* Give the clipboard time to synchronise. */
77 RTThreadSleep(500);
78 rc = ShClX11ThreadStop(&X11Ctx);
79 AssertRCReturn(rc, 1);
80 ShClX11Destroy(&X11Ctx);
81 return RTTestSummaryAndDestroy(hTest);
82}
83
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