From 2d970c26f02b56e4d98ab148fbed5d2753427672 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 29 Oct 2002 15:46:38 -0500 Subject: Add test for X11 --- Source/CMakeLists.txt | 5 +++++ Tests/X11/CMakeLists.txt | 11 +++++++++++ Tests/X11/X11.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 Tests/X11/CMakeLists.txt create mode 100644 Tests/X11/X11.c diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index bf76259..e3303cc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -147,6 +147,11 @@ IF(BUILD_TESTING) ${CMake_BINARY_DIR}/Tests/COnly conly) + ADD_TEST(X11 ${CMake_BINARY_DIR}/Source/cmaketest + ${CMake_SOURCE_DIR}/Tests/X11 + ${CMake_BINARY_DIR}/Tests/X11 + X11) + ADD_TEST(LoadedCommand ${CMake_BINARY_DIR}/Source/cmaketest ${CMake_SOURCE_DIR}/Tests/LoadCommand ${CMake_BINARY_DIR}/Tests/LoadCommand diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt new file mode 100644 index 0000000..d97b4fb --- /dev/null +++ b/Tests/X11/CMakeLists.txt @@ -0,0 +1,11 @@ +# a simple C only test case +PROJECT (X11 C) + +INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake) + +IF(CMAKE_HAS_X) + INCLUDE_DIRECTORIES(${CMAKE_X_CFLAGS}) + + ADD_EXECUTABLE (X11 X11.c) + TARGET_LINK_LIBRARIES(X11 ${CMAKE_X_LIBS}) +ENDIF(CMAKE_HAS_X) diff --git a/Tests/X11/X11.c b/Tests/X11/X11.c new file mode 100644 index 0000000..b877b31 --- /dev/null +++ b/Tests/X11/X11.c @@ -0,0 +1,38 @@ +#include +#include + +char hello[]="hello.world"; +char hi[]="Hi"; + +main(argc, argv) +int argc; +char **argv; +{ + Display *mydisplay; + Window mywindow; + GC mygc; + + XEvent myevent; + KeySym mykey; + + XSizeHints myhint; + int myscreen; + unsigned long myforeground, mybackground; + int i; + char text[10]; + int done; + + mydisplay=XOpenDisplay(""); + myscreen=DefaultScreen(mydisplay); + myforeground=BlackPixel(mydisplay, myscreen); + + mywindow=XCreateSimpleWindow(mydisplay, + DefaultRootWindow(mydisplay), + myhint.x, myhint.y, myhint.width, myhint.height, 5, + myforeground, mybackground ); + XDestroyWindow(mydisplay, mywindow); + XCloseDisplay(mydisplay); + exit(0); +} + + -- cgit v0.12