Commit MetaInfo

Revision813e810cbfe48b5a5521953f31b05963dad4f5a6 (tree)
Time2011-07-26 23:31:22
Authormasahino
Commitermasahino

Log Message

add test directory

Change Summary

Incremental Difference

diff -r 46cafd358ac0 -r 813e810cbfe4 test/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/Makefile.am Tue Jul 26 23:31:22 2011 +0900
@@ -0,0 +1,26 @@
1+if WITH_CUTTER
2+TESTS = run-test.sh
3+TESTS_ENVIRONMENT = NO_MAKE=yes CUTTER="$(CUTTER)"
4+
5+endif
6+
7+ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS
8+
9+check_LTLIBRARIES = \
10+ test_wmgeneral.la
11+
12+test_wmgeneral_la_SOURCES = test-wmgeneral.c $(top_srcdir)/src/wmgeneral.c
13+
14+LIBS = $(CUTTER_LIBS) \
15+ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXpm -lXext @IMLIB2_LIBS@
16+
17+AM_CFLAGS = \
18+ $(CUTTER_CFLAGS)
19+
20+AM_LDFLAGS = \
21+ -module \
22+ -rpath `pwd`/.libs \
23+ -avoid-version \
24+ -no-undefined
25+
26+INCLUDES = -I$(top_srcdir)/src
diff -r 46cafd358ac0 -r 813e810cbfe4 test/run-test.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/run-test.sh Tue Jul 26 23:31:22 2011 +0900
@@ -0,0 +1,27 @@
1+#!/bin/sh
2+
3+export BASE_DIR="`dirname $0`"
4+top_dir="$BASE_DIR/.."
5+
6+if test -z "$NO_MAKE"; then
7+ make -C $top_dir > /dev/null || exit 1
8+fi
9+
10+if test -z "$CUTTER"; then
11+ CUTTER="`make -s -C $BASE_DIR echo-cutter`"
12+fi
13+
14+case `uname` in
15+ CYGWIN*)
16+ PATH="$top_dir/src/.libs:$PATH"
17+ ;;
18+ Darwin)
19+ DYLD_LIBRARY_PATH="$top_dir/src/.libs:$DYLD_LIBRARY_PATH"
20+ export DYLD_LIBRARY_PATH
21+ ;;
22+ *)
23+ :
24+ ;;
25+esac
26+
27+$CUTTER -s $BASE_DIR "$@" $BASE_DIR
diff -r 46cafd358ac0 -r 813e810cbfe4 test/test-wmgeneral.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/test-wmgeneral.c Tue Jul 26 23:31:22 2011 +0900
@@ -0,0 +1,39 @@
1+#include <cutter.h>
2+
3+#include <X11/xpm.h>
4+#include <wmgeneral.h>
5+
6+Display *display;
7+Window Root;
8+GC NormalGC;
9+XpmIcon wmgen;
10+XpmIcon text_pixmap;
11+XFontSet fontset;
12+
13+extern MOUSE_REGION mouse_region[MAX_MOUSE_REGION];
14+
15+void dbgprintf(const char *fmt, ...)
16+{
17+}
18+
19+void cut_setup()
20+{
21+}
22+
23+void
24+test_AddMouseRegion (void)
25+{
26+ AddMouseRegion(0, 10, 20, 30, 40);
27+ cut_assert_equal_int(1, mouse_region[0].enable);
28+ cut_assert_equal_int(10, mouse_region[0].left);
29+ cut_assert_equal_int(20, mouse_region[0].top);
30+ cut_assert_equal_int(30, mouse_region[0].right);
31+ cut_assert_equal_int(40, mouse_region[0].bottom);
32+}
33+
34+void
35+test_CheckMouseRegion (void)
36+{
37+ AddMouseRegion(0, 10, 20, 30, 40);
38+ cut_assert_equal_int(-1, CheckMouseRegion(0,0));
39+}
Show on old repository browser