Add test for X11
This commit is contained in:
parent
5e2cc830f8
commit
2d970c26f0
|
@ -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
|
||||
|
|
|
@ -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)
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue