Add test for X11

This commit is contained in:
Andy Cedilnik 2002-10-29 15:46:38 -05:00
parent 5e2cc830f8
commit 2d970c26f0
3 changed files with 54 additions and 0 deletions

View File

@ -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

11
Tests/X11/CMakeLists.txt Normal file
View File

@ -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)

38
Tests/X11/X11.c Normal file
View File

@ -0,0 +1,38 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
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);
}