- Conditionally build gdk-dependent test apps if we have gdk.
- Added a X, Y stress test that will be used to help test accurately positioning the arrows.
This commit is contained in:
parent
7848ca6968
commit
635fc9d10a
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Mon Jul 04 02:13:56 PDT 2005 Christian Hammond <chipx86@chipx86.com>
|
||||||
|
|
||||||
|
* tests/Makefile.am:
|
||||||
|
* tests/test-markup.c:
|
||||||
|
A tests/test-xy-stress.c:
|
||||||
|
* configure.ac:
|
||||||
|
- Conditionally build gdk-dependent test apps if we have gdk.
|
||||||
|
- Added a X, Y stress test that will be used to help test
|
||||||
|
accurately positioning the arrows.
|
||||||
|
|
||||||
Thu Jun 30 21:09:18 PDT 2005 Christian Hammond <chipx86@chipx86.com>
|
Thu Jun 30 21:09:18 PDT 2005 Christian Hammond <chipx86@chipx86.com>
|
||||||
|
|
||||||
* tests/Makefile.am:
|
* tests/Makefile.am:
|
||||||
|
|
13
configure.ac
13
configure.ac
|
@ -94,6 +94,19 @@ PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
|
||||||
AC_SUBST(PACKAGE_CFLAGS)
|
AC_SUBST(PACKAGE_CFLAGS)
|
||||||
AC_SUBST(PACKAGE_LIBS)
|
AC_SUBST(PACKAGE_LIBS)
|
||||||
|
|
||||||
|
gdk_modules="gdk-2.0 gdk-pixbuf-2.0"
|
||||||
|
PKG_CHECK_MODULES(GDK, [$gdk_modules], have_gdk=yes,
|
||||||
|
[
|
||||||
|
have_gdk=no
|
||||||
|
|
||||||
|
AC_WARN("Some test apps will not be built")
|
||||||
|
])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HAVE_GDK, test "x$have_gdk" = "xyes")
|
||||||
|
|
||||||
|
AC_SUBST(GDK_CFLAGS)
|
||||||
|
AC_SUBST(GDK_LIBS)
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Check the D-BUS version.
|
dnl Check the D-BUS version.
|
||||||
dnl
|
dnl
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
if HAVE_GDK
|
||||||
|
gdk_tests = \
|
||||||
|
test-animation \
|
||||||
|
test-xy-stress
|
||||||
|
|
||||||
|
test_animation_SOURCES = test-animation.c
|
||||||
|
test_xy_stress_SOURCES = test-xy-stress.c
|
||||||
|
else
|
||||||
|
gdk_tests =
|
||||||
|
endif
|
||||||
|
|
||||||
noinst_PROGRAMS = \
|
noinst_PROGRAMS = \
|
||||||
test-replace \
|
test-replace \
|
||||||
test-default-action \
|
test-default-action \
|
||||||
|
@ -5,15 +16,14 @@ noinst_PROGRAMS = \
|
||||||
test-image \
|
test-image \
|
||||||
test-basic \
|
test-basic \
|
||||||
test-error \
|
test-error \
|
||||||
test-animation \
|
|
||||||
test-markup \
|
test-markup \
|
||||||
test-xy
|
test-xy \
|
||||||
|
$(gdk_tests)
|
||||||
|
|
||||||
common_ldflags = \
|
common_ldflags = \
|
||||||
$(top_builddir)/libnotify/libnotify.la \
|
$(top_builddir)/libnotify/libnotify.la \
|
||||||
$(PACKAGE_LIBS)
|
$(PACKAGE_LIBS) \
|
||||||
|
$(GDK_LIBS)
|
||||||
# FIXME: don't install these
|
|
||||||
|
|
||||||
test_replace_SOURCES = test-replace.c
|
test_replace_SOURCES = test-replace.c
|
||||||
test_replace_LDADD = $(common_ldflags)
|
test_replace_LDADD = $(common_ldflags)
|
||||||
|
@ -28,9 +38,7 @@ test_basic_LDADD = $(common_ldflags)
|
||||||
test_error_SOURCES = test-error.c
|
test_error_SOURCES = test-error.c
|
||||||
test_error_LDADD = $(common_ldflags)
|
test_error_LDADD = $(common_ldflags)
|
||||||
|
|
||||||
test_animation_SOURCES = test-animation.c
|
|
||||||
test_animation_LDADD = $(common_ldflags)
|
test_animation_LDADD = $(common_ldflags)
|
||||||
test_animation_LDFLAGS = `pkg-config --libs gdk-pixbuf-2.0`
|
|
||||||
|
|
||||||
test_markup_SOURCES = test-markup.c
|
test_markup_SOURCES = test-markup.c
|
||||||
test_markup_LDADD = $(common_ldflags)
|
test_markup_LDADD = $(common_ldflags)
|
||||||
|
@ -38,4 +46,6 @@ test_markup_LDADD = $(common_ldflags)
|
||||||
test_xy_SOURCES = test-xy.c
|
test_xy_SOURCES = test-xy.c
|
||||||
test_xy_LDADD = $(common_ldflags)
|
test_xy_LDADD = $(common_ldflags)
|
||||||
|
|
||||||
INCLUDES = $(PACKAGE_CFLAGS) `pkg-config --cflags gdk-pixbuf-2.0`
|
test_xy_stress_LDADD = $(common_ldflags)
|
||||||
|
|
||||||
|
INCLUDES = $(PACKAGE_CFLAGS) $(GDK_CFLAGS)
|
||||||
|
|
|
@ -34,7 +34,7 @@ int main() {
|
||||||
"Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, "
|
"Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, "
|
||||||
"<a href='http://www.google.com'>linked</a> text",
|
"<a href='http://www.google.com'>linked</a> text",
|
||||||
NULL, // no icon
|
NULL, // no icon
|
||||||
TRUE, time(NULL) + 5,
|
FALSE, 0,
|
||||||
NULL, // no hints
|
NULL, // no hints
|
||||||
NULL, // no user data
|
NULL, // no user data
|
||||||
0); // no actions
|
0); // no actions
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
* @file tests/test-xy.c Unit test: X, Y hints
|
||||||
|
*
|
||||||
|
* @Copyright (C) 2005 Christian Hammond <chipx86@chipx86.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libnotify/notify.h>
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
emit_notification(int x, int y)
|
||||||
|
{
|
||||||
|
NotifyHints *hints;
|
||||||
|
static char buffer[BUFSIZ];
|
||||||
|
|
||||||
|
hints = notify_hints_new();
|
||||||
|
notify_hints_set_int(hints, "x", x);
|
||||||
|
notify_hints_set_int(hints, "y", y);
|
||||||
|
|
||||||
|
g_snprintf(buffer, sizeof(buffer),
|
||||||
|
"This notification should point to %d, %d.", x, y);
|
||||||
|
|
||||||
|
NotifyHandle *n = notify_send_notification(
|
||||||
|
NULL, // replaces nothing
|
||||||
|
NULL,
|
||||||
|
NOTIFY_URGENCY_NORMAL,
|
||||||
|
"X, Y Test",
|
||||||
|
buffer,
|
||||||
|
NULL, // no icon
|
||||||
|
TRUE, time(NULL) + 5,
|
||||||
|
hints,
|
||||||
|
NULL, // no user data
|
||||||
|
0); // no actions
|
||||||
|
|
||||||
|
if (!n) {
|
||||||
|
fprintf(stderr, "failed to send notification\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
GdkDisplay *display;
|
||||||
|
GdkScreen *screen;
|
||||||
|
int screen_x2, screen_y2;
|
||||||
|
|
||||||
|
gdk_init(&argc, &argv);
|
||||||
|
|
||||||
|
notify_init("XY");
|
||||||
|
|
||||||
|
display = gdk_display_get_default();
|
||||||
|
screen = gdk_display_get_default_screen(display);
|
||||||
|
screen_x2 = gdk_screen_get_width(screen) - 1;
|
||||||
|
screen_y2 = gdk_screen_get_height(screen) - 1;
|
||||||
|
|
||||||
|
emit_notification(0, 0);
|
||||||
|
emit_notification(screen_x2, 0);
|
||||||
|
emit_notification(5, 150);
|
||||||
|
emit_notification(screen_x2 - 5, 150);
|
||||||
|
emit_notification(0, screen_y2 / 2);
|
||||||
|
emit_notification(screen_x2, screen_y2 / 2);
|
||||||
|
emit_notification(5, screen_y2 - 150);
|
||||||
|
emit_notification(screen_x2 - 5, screen_y2 - 150);
|
||||||
|
emit_notification(0, screen_y2);
|
||||||
|
emit_notification(screen_x2, screen_y2);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue