aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-07-11 21:39:51 +0200
committerSebastien Bacher <seb128@ubuntu.com>2012-07-11 21:39:51 +0200
commit4af0bd2bf3acca2dc08656ba0e7105a28e2d0d1b (patch)
tree403adab544ae9d295497f0c9d5eee5eb2d37c3a3 /tests
parent109d4fe4271cef7438273eb5a24b719a73e9a4fb (diff)
parent7bc1a483d52707854f6f813fbbbed4709fe38f34 (diff)
downloadayatana-indicator-power-4af0bd2bf3acca2dc08656ba0e7105a28e2d0d1b.tar.gz
ayatana-indicator-power-4af0bd2bf3acca2dc08656ba0e7105a28e2d0d1b.tar.bz2
ayatana-indicator-power-4af0bd2bf3acca2dc08656ba0e7105a28e2d0d1b.zip
Import upstream version 12.10.0
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am62
-rw-r--r--tests/Makefile.am.strings38
-rw-r--r--tests/Makefile.in843
-rw-r--r--tests/test-device.cc470
-rw-r--r--tests/test-indicator.cc312
5 files changed, 1725 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..0c60247
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,62 @@
+TESTS =
+CLEANFILES =
+BUILT_SOURCES =
+check_PROGRAMS =
+
+###
+###
+###
+
+# stock UMB tests on user-visible strings
+include $(srcdir)/Makefile.am.strings
+
+check_LIBRARIES = libgtest.a
+nodist_libgtest_a_SOURCES = \
+ $(GTEST_SOURCE)/src/gtest-all.cc \
+ $(GTEST_SOURCE)/src/gtest_main.cc
+
+AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I${top_srcdir}/src -Wall -Werror
+AM_CXXFLAGS = $(GTEST_CXXFLAGS)
+
+###
+###
+###
+
+TEST_LIBS = \
+ $(top_builddir)/src/.libs/libpower.a \
+ $(INDICATOR_LIBS) \
+ $(UPOWER_LIBS) \
+ $(COVERAGE_LDFLAGS) \
+ libgtest.a
+
+TEST_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(UPOWER_CFLAGS) \
+ $(INDICATOR_CFLAGS)
+
+BUILT_SOURCES += gschemas.compiled
+CLEANFILES += gschemas.compiled
+gschemas.compiled: Makefile
+ @glib-compile-schemas --targetdir=$(abs_builddir) $(top_builddir)/data
+
+TESTS += test-device
+check_PROGRAMS += test-device
+test_device_SOURCES = test-device.cc
+test_device_LDADD = $(TEST_LIBS)
+test_device_CPPFLAGS = $(TEST_CPPFLAGS)
+
+#TESTS += test-dbus-listener
+#check_PROGRAMS += test-dbus-listener
+#test_dbus_listener_SOURCES = test-dbus-listener.cc
+#test_dbus_listener_LDADD = $(TEST_LIBS)
+#test_dbus_listener_CPPFLAGS = $(TEST_CPPFLAGS)
+
+TESTS += test-indicator
+check_PROGRAMS += test-indicator
+test_indicator_SOURCES = test-indicator.cc
+test_indicator_LDADD = $(TEST_LIBS)
+test_indicator_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\""
+
+###
+###
+###
diff --git a/tests/Makefile.am.strings b/tests/Makefile.am.strings
new file mode 100644
index 0000000..26a23a8
--- /dev/null
+++ b/tests/Makefile.am.strings
@@ -0,0 +1,38 @@
+TESTS += \
+ test-ellipsis \
+ test-space-ellipsis \
+ test-ascii-quotes
+
+#####
+# Tests for there being proper ellipsis instead of three periods in a row
+#####
+test-ellipsis: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid.*\.\.\.\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Ellipsis found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+
+#####
+# Tests for there being a space before an ellipsis
+#####
+test-space-ellipsis: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid.* …\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Space before ellipsis found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+
+#####
+# Tests for ASCII quote types
+#####
+test-ascii-quotes: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid \\\".*'.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII apostrophy found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "grep -c -e \"^msgid \\\".*\\\".*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII quote found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "grep -c -e \"^msgid \\\".*\\\`.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII backtick found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+
+CLEANFILES += $(TESTS)
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..4a20f80
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,843 @@
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+TESTS = test-ellipsis test-space-ellipsis test-ascii-quotes \
+ test-device$(EXEEXT) test-indicator$(EXEEXT)
+check_PROGRAMS = test-device$(EXEEXT) test-indicator$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.am.strings \
+ $(srcdir)/Makefile.in
+subdir = tests
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gtest.m4 \
+ $(top_srcdir)/m4/gcov.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+libgtest_a_AR = $(AR) $(ARFLAGS)
+libgtest_a_LIBADD =
+nodist_libgtest_a_OBJECTS = gtest-all.$(OBJEXT) gtest_main.$(OBJEXT)
+libgtest_a_OBJECTS = $(nodist_libgtest_a_OBJECTS)
+am_test_device_OBJECTS = test_device-test-device.$(OBJEXT)
+test_device_OBJECTS = $(am_test_device_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(top_builddir)/src/.libs/libpower.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) libgtest.a
+test_device_DEPENDENCIES = $(am__DEPENDENCIES_2)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am_test_indicator_OBJECTS = test_indicator-test-indicator.$(OBJEXT)
+test_indicator_OBJECTS = $(am_test_indicator_OBJECTS)
+test_indicator_DEPENDENCIES = $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(nodist_libgtest_a_SOURCES) $(test_device_SOURCES) \
+ $(test_indicator_SOURCES)
+DIST_SOURCES = $(test_device_SOURCES) $(test_indicator_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CXXFLAGS = @BASE_CXXFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
+COVERAGE_CXXFLAGS = @COVERAGE_CXXFLAGS@
+COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EVEMU_CFLAGS = @EVEMU_CFLAGS@
+EVEMU_LIBS = @EVEMU_LIBS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GCOVR = @GCOVR@
+GENHTML = @GENHTML@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+GSD_CFLAGS = @GSD_CFLAGS@
+GSD_LIBS = @GSD_LIBS@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
+GTEST_CPPFLAGS = @GTEST_CPPFLAGS@
+GTEST_SOURCE = @GTEST_SOURCE@
+INDICATORDIR = @INDICATORDIR@
+INDICATORICONSDIR = @INDICATORICONSDIR@
+INDICATOR_CFLAGS = @INDICATOR_CFLAGS@
+INDICATOR_LIBS = @INDICATOR_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LCOV = @LCOV@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHTOOL = @SHTOOL@
+STRICT_CXXFLAGS = @STRICT_CXXFLAGS@
+STRIP = @STRIP@
+UPOWER_CFLAGS = @UPOWER_CFLAGS@
+UPOWER_LIBS = @UPOWER_LIBS@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XORG_GTEST_CPPFLAGS = @XORG_GTEST_CPPFLAGS@
+XORG_GTEST_SOURCE = @XORG_GTEST_SOURCE@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CLEANFILES = $(TESTS) gschemas.compiled
+BUILT_SOURCES = gschemas.compiled
+
+###
+###
+###
+
+# stock UMB tests on user-visible strings
+check_LIBRARIES = libgtest.a
+nodist_libgtest_a_SOURCES = \
+ $(GTEST_SOURCE)/src/gtest-all.cc \
+ $(GTEST_SOURCE)/src/gtest_main.cc
+
+AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I${top_srcdir}/src -Wall -Werror
+AM_CXXFLAGS = $(GTEST_CXXFLAGS)
+
+###
+###
+###
+TEST_LIBS = \
+ $(top_builddir)/src/.libs/libpower.a \
+ $(INDICATOR_LIBS) \
+ $(UPOWER_LIBS) \
+ $(COVERAGE_LDFLAGS) \
+ libgtest.a
+
+TEST_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(UPOWER_CFLAGS) \
+ $(INDICATOR_CFLAGS)
+
+test_device_SOURCES = test-device.cc
+test_device_LDADD = $(TEST_LIBS)
+test_device_CPPFLAGS = $(TEST_CPPFLAGS)
+test_indicator_SOURCES = test-indicator.cc
+test_indicator_LDADD = $(TEST_LIBS)
+test_indicator_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\""
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.am.strings $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+$(srcdir)/Makefile.am.strings:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkLIBRARIES:
+ -test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES)
+libgtest.a: $(libgtest_a_OBJECTS) $(libgtest_a_DEPENDENCIES) $(EXTRA_libgtest_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libgtest.a
+ $(AM_V_AR)$(libgtest_a_AR) libgtest.a $(libgtest_a_OBJECTS) $(libgtest_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libgtest.a
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+test-device$(EXEEXT): $(test_device_OBJECTS) $(test_device_DEPENDENCIES) $(EXTRA_test_device_DEPENDENCIES)
+ @rm -f test-device$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_device_OBJECTS) $(test_device_LDADD) $(LIBS)
+test-indicator$(EXEEXT): $(test_indicator_OBJECTS) $(test_indicator_DEPENDENCIES) $(EXTRA_test_indicator_DEPENDENCIES)
+ @rm -f test-indicator$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_indicator_OBJECTS) $(test_indicator_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtest-all.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtest_main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_device-test-device.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_indicator-test-indicator.Po@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+gtest-all.o: $(GTEST_SOURCE)/src/gtest-all.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gtest-all.o -MD -MP -MF $(DEPDIR)/gtest-all.Tpo -c -o gtest-all.o `test -f '$(GTEST_SOURCE)/src/gtest-all.cc' || echo '$(srcdir)/'`$(GTEST_SOURCE)/src/gtest-all.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtest-all.Tpo $(DEPDIR)/gtest-all.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(GTEST_SOURCE)/src/gtest-all.cc' object='gtest-all.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gtest-all.o `test -f '$(GTEST_SOURCE)/src/gtest-all.cc' || echo '$(srcdir)/'`$(GTEST_SOURCE)/src/gtest-all.cc
+
+gtest-all.obj: $(GTEST_SOURCE)/src/gtest-all.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gtest-all.obj -MD -MP -MF $(DEPDIR)/gtest-all.Tpo -c -o gtest-all.obj `if test -f '$(GTEST_SOURCE)/src/gtest-all.cc'; then $(CYGPATH_W) '$(GTEST_SOURCE)/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/$(GTEST_SOURCE)/src/gtest-all.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtest-all.Tpo $(DEPDIR)/gtest-all.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(GTEST_SOURCE)/src/gtest-all.cc' object='gtest-all.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gtest-all.obj `if test -f '$(GTEST_SOURCE)/src/gtest-all.cc'; then $(CYGPATH_W) '$(GTEST_SOURCE)/src/gtest-all.cc'; else $(CYGPATH_W) '$(srcdir)/$(GTEST_SOURCE)/src/gtest-all.cc'; fi`
+
+gtest_main.o: $(GTEST_SOURCE)/src/gtest_main.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gtest_main.o -MD -MP -MF $(DEPDIR)/gtest_main.Tpo -c -o gtest_main.o `test -f '$(GTEST_SOURCE)/src/gtest_main.cc' || echo '$(srcdir)/'`$(GTEST_SOURCE)/src/gtest_main.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtest_main.Tpo $(DEPDIR)/gtest_main.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(GTEST_SOURCE)/src/gtest_main.cc' object='gtest_main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gtest_main.o `test -f '$(GTEST_SOURCE)/src/gtest_main.cc' || echo '$(srcdir)/'`$(GTEST_SOURCE)/src/gtest_main.cc
+
+gtest_main.obj: $(GTEST_SOURCE)/src/gtest_main.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gtest_main.obj -MD -MP -MF $(DEPDIR)/gtest_main.Tpo -c -o gtest_main.obj `if test -f '$(GTEST_SOURCE)/src/gtest_main.cc'; then $(CYGPATH_W) '$(GTEST_SOURCE)/src/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/$(GTEST_SOURCE)/src/gtest_main.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gtest_main.Tpo $(DEPDIR)/gtest_main.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(GTEST_SOURCE)/src/gtest_main.cc' object='gtest_main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gtest_main.obj `if test -f '$(GTEST_SOURCE)/src/gtest_main.cc'; then $(CYGPATH_W) '$(GTEST_SOURCE)/src/gtest_main.cc'; else $(CYGPATH_W) '$(srcdir)/$(GTEST_SOURCE)/src/gtest_main.cc'; fi`
+
+test_device-test-device.o: test-device.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_device_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_device-test-device.o -MD -MP -MF $(DEPDIR)/test_device-test-device.Tpo -c -o test_device-test-device.o `test -f 'test-device.cc' || echo '$(srcdir)/'`test-device.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_device-test-device.Tpo $(DEPDIR)/test_device-test-device.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test-device.cc' object='test_device-test-device.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_device_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_device-test-device.o `test -f 'test-device.cc' || echo '$(srcdir)/'`test-device.cc
+
+test_device-test-device.obj: test-device.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_device_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_device-test-device.obj -MD -MP -MF $(DEPDIR)/test_device-test-device.Tpo -c -o test_device-test-device.obj `if test -f 'test-device.cc'; then $(CYGPATH_W) 'test-device.cc'; else $(CYGPATH_W) '$(srcdir)/test-device.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_device-test-device.Tpo $(DEPDIR)/test_device-test-device.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test-device.cc' object='test_device-test-device.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_device_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_device-test-device.obj `if test -f 'test-device.cc'; then $(CYGPATH_W) 'test-device.cc'; else $(CYGPATH_W) '$(srcdir)/test-device.cc'; fi`
+
+test_indicator-test-indicator.o: test-indicator.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_indicator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_indicator-test-indicator.o -MD -MP -MF $(DEPDIR)/test_indicator-test-indicator.Tpo -c -o test_indicator-test-indicator.o `test -f 'test-indicator.cc' || echo '$(srcdir)/'`test-indicator.cc
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator-test-indicator.Tpo $(DEPDIR)/test_indicator-test-indicator.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test-indicator.cc' object='test_indicator-test-indicator.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_indicator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_indicator-test-indicator.o `test -f 'test-indicator.cc' || echo '$(srcdir)/'`test-indicator.cc
+
+test_indicator-test-indicator.obj: test-indicator.cc
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_indicator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test_indicator-test-indicator.obj -MD -MP -MF $(DEPDIR)/test_indicator-test-indicator.Tpo -c -o test_indicator-test-indicator.obj `if test -f 'test-indicator.cc'; then $(CYGPATH_W) 'test-indicator.cc'; else $(CYGPATH_W) '$(srcdir)/test-indicator.cc'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_indicator-test-indicator.Tpo $(DEPDIR)/test_indicator-test-indicator.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test-indicator.cc' object='test_indicator-test-indicator.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_indicator_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test_indicator-test-indicator.obj `if test -f 'test-indicator.cc'; then $(CYGPATH_W) 'test-indicator.cc'; else $(CYGPATH_W) '$(srcdir)/test-indicator.cc'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LIBRARIES) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check check-am install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+#####
+# Tests for there being proper ellipsis instead of three periods in a row
+#####
+test-ellipsis: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid.*\.\.\.\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Ellipsis found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+
+#####
+# Tests for there being a space before an ellipsis
+#####
+test-space-ellipsis: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid.* …\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"Space before ellipsis found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+
+#####
+# Tests for ASCII quote types
+#####
+test-ascii-quotes: $(top_srcdir)/po
+ @echo "#!/bin/bash" > $@
+ @echo "(cd $(top_srcdir)/po && make $(GETTEXT_PACKAGE).pot)" >> $@
+ @echo "grep -c -e \"^msgid \\\".*'.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII apostrophy found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "grep -c -e \"^msgid \\\".*\\\".*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII quote found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "grep -c -e \"^msgid \\\".*\\\`.*\\\"\" $(top_srcdir)/po/$(GETTEXT_PACKAGE).pot > /dev/null && echo \"ASCII backtick found in user visible strings\" >&2 && exit 1" >> $@
+ @echo "exit 0" >> $@
+ @chmod +x $@
+gschemas.compiled: Makefile
+ @glib-compile-schemas --targetdir=$(abs_builddir) $(top_builddir)/data
+
+###
+###
+###
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/test-device.cc b/tests/test-device.cc
new file mode 100644
index 0000000..2c88ea1
--- /dev/null
+++ b/tests/test-device.cc
@@ -0,0 +1,470 @@
+/*
+Copyright 2012 Canonical Ltd.
+
+Authors:
+ Charles Kerr <charles.kerr@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <gtest/gtest.h>
+#include "device.h"
+
+namespace
+{
+ void ensure_glib_initialized ()
+ {
+ static bool initialized = false;
+
+ if (G_UNLIKELY(!initialized))
+ {
+ initialized = true;
+ g_type_init();
+ }
+ }
+}
+
+class DeviceTest : public ::testing::Test
+{
+ protected:
+
+ virtual void SetUp()
+ {
+ ensure_glib_initialized ();
+ }
+
+ virtual void TearDown()
+ {
+ }
+
+ protected:
+
+ void check_icon_names (const IndicatorPowerDevice * device, const char * expected)
+ {
+ char ** names = indicator_power_device_get_icon_names (device);
+ char * str = g_strjoinv (";", names);
+ ASSERT_STREQ (expected, str);
+ g_free (str);
+ g_strfreev (names);
+ }
+
+ void check_strings (const IndicatorPowerDevice * device,
+ const char * expected_timestring,
+ const char * expected_details,
+ const char * expected_accessible)
+ {
+ char * timestring = NULL;
+ char * details = NULL;
+ char * accessible = NULL;
+
+ indicator_power_device_get_time_details (device, &timestring, &details, &accessible);
+ EXPECT_STREQ (expected_timestring, timestring);
+ EXPECT_STREQ (expected_details, details);
+ EXPECT_STREQ (expected_accessible, accessible);
+
+ g_free (accessible);
+ g_free (details);
+ g_free (timestring);
+ }
+};
+
+
+/***
+****
+***/
+
+TEST_F(DeviceTest, GObjectNew)
+{
+ ensure_glib_initialized ();
+
+ GObject * o = G_OBJECT (g_object_new (INDICATOR_POWER_DEVICE_TYPE, NULL));
+ ASSERT_TRUE (o != NULL);
+ ASSERT_TRUE (INDICATOR_IS_POWER_DEVICE(o));
+ g_object_run_dispose (o); // used to get coverage of both branches in the object's dispose func's g_clear_*() calls
+ g_object_unref (o);
+}
+
+TEST_F(DeviceTest, Properties)
+{
+ int i;
+ gdouble d;
+ GObject * o;
+ gchar * str;
+ guint64 u64;
+ const gchar * key;
+
+ ensure_glib_initialized ();
+
+ o = G_OBJECT (g_object_new (INDICATOR_POWER_DEVICE_TYPE, NULL));
+ ASSERT_TRUE (o != NULL);
+ ASSERT_TRUE (INDICATOR_IS_POWER_DEVICE(o));
+
+ // Test getting & setting a Device's properties.
+
+ // KIND
+ key = INDICATOR_POWER_DEVICE_KIND;
+ g_object_set (o, key, UP_DEVICE_KIND_BATTERY, NULL);
+ g_object_get (o, key, &i, NULL);
+ ASSERT_EQ (i, UP_DEVICE_KIND_BATTERY);
+
+ // STATE
+ key = INDICATOR_POWER_DEVICE_STATE;
+ g_object_set (o, key, UP_DEVICE_STATE_CHARGING, NULL);
+ g_object_get (o, key, &i, NULL);
+ ASSERT_EQ (i, UP_DEVICE_STATE_CHARGING);
+
+ // OBJECT_PATH
+ key = INDICATOR_POWER_DEVICE_OBJECT_PATH;
+ g_object_set (o, key, "/object/path", NULL);
+ g_object_get (o, key, &str, NULL);
+ ASSERT_STREQ (str, "/object/path");
+ g_free (str);
+
+ // PERCENTAGE
+ key = INDICATOR_POWER_DEVICE_PERCENTAGE;
+ g_object_set (o, key, 50.0, NULL);
+ g_object_get (o, key, &d, NULL);
+ ASSERT_EQ((int)d, 50);
+
+ // TIME
+ key = INDICATOR_POWER_DEVICE_TIME;
+ g_object_set (o, key, (guint64)30, NULL);
+ g_object_get (o, key, &u64, NULL);
+ ASSERT_EQ(u64, 30);
+
+ // cleanup
+ g_object_unref (o);
+}
+
+TEST_F(DeviceTest, New)
+{
+ ensure_glib_initialized ();
+
+ IndicatorPowerDevice * device = indicator_power_device_new ("/object/path",
+ UP_DEVICE_KIND_BATTERY,
+ 50.0,
+ UP_DEVICE_STATE_CHARGING,
+ 30);
+ ASSERT_TRUE (device != NULL);
+ ASSERT_TRUE (INDICATOR_IS_POWER_DEVICE(device));
+ ASSERT_EQ (indicator_power_device_get_kind(device), UP_DEVICE_KIND_BATTERY);
+ ASSERT_EQ (indicator_power_device_get_state(device), UP_DEVICE_STATE_CHARGING);
+ ASSERT_STREQ (indicator_power_device_get_object_path(device), "/object/path");
+ ASSERT_EQ ((int)indicator_power_device_get_percentage(device), 50);
+ ASSERT_EQ (indicator_power_device_get_time(device), 30);
+
+ // cleanup
+ g_object_unref (device);
+}
+
+TEST_F(DeviceTest, NewFromVariant)
+{
+ ensure_glib_initialized ();
+
+ GVariant * variant = g_variant_new ("(susdut)",
+ "/object/path",
+ UP_DEVICE_KIND_BATTERY,
+ "icon",
+ 50.0,
+ UP_DEVICE_STATE_CHARGING,
+ 30);
+ IndicatorPowerDevice * device = indicator_power_device_new_from_variant (variant);
+ ASSERT_TRUE (variant != NULL);
+ ASSERT_TRUE (device != NULL);
+ ASSERT_TRUE (INDICATOR_IS_POWER_DEVICE(device));
+ ASSERT_EQ (indicator_power_device_get_kind(device), UP_DEVICE_KIND_BATTERY);
+ ASSERT_EQ (indicator_power_device_get_state(device), UP_DEVICE_STATE_CHARGING);
+ ASSERT_STREQ (indicator_power_device_get_object_path(device), "/object/path");
+ ASSERT_EQ ((int)indicator_power_device_get_percentage(device), 50);
+ ASSERT_EQ (indicator_power_device_get_time(device), 30);
+
+ // cleanup
+ g_object_unref (device);
+ g_variant_unref (variant);
+}
+
+TEST_F(DeviceTest, BadAccessors)
+{
+ ensure_glib_initialized ();
+
+ // test that these functions can handle being passed NULL pointers
+ IndicatorPowerDevice * device = NULL;
+ indicator_power_device_get_kind (device);
+ indicator_power_device_get_time (device);
+ indicator_power_device_get_state (device);
+ indicator_power_device_get_percentage (device);
+ indicator_power_device_get_object_path (device);
+
+ // test that these functions can handle being passed non-device GObjects
+ device = reinterpret_cast<IndicatorPowerDevice*>(g_cancellable_new ());
+ indicator_power_device_get_kind (device);
+ indicator_power_device_get_time (device);
+ indicator_power_device_get_state (device);
+ indicator_power_device_get_percentage (device);
+ indicator_power_device_get_object_path (device);
+ g_object_unref (device);
+}
+
+/***
+****
+***/
+
+TEST_F(DeviceTest, IconNames)
+{
+ IndicatorPowerDevice * device = INDICATOR_POWER_DEVICE (g_object_new (INDICATOR_POWER_DEVICE_TYPE, NULL));
+ GObject * o = G_OBJECT(device);
+
+ // bad arguments
+ ASSERT_TRUE (indicator_power_device_get_icon_names (NULL) == NULL);
+
+ // power
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_LINE_POWER,
+ NULL);
+ check_icon_names (device, "ac-adapter-symbolic;"
+ "ac-adapter");
+
+ // monitor
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_MONITOR,
+ NULL);
+ check_icon_names (device, "gpm-monitor-symbolic;"
+ "gpm-monitor");
+
+ // empty battery
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_EMPTY,
+ NULL);
+ check_icon_names (device, "battery-empty-symbolic;"
+ "gpm-battery-empty;"
+ "gpm-battery-000;"
+ "battery-empty");
+
+ // charged battery
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_FULLY_CHARGED,
+ NULL);
+ check_icon_names (device, "battery-full-charged-symbolic;battery-full-charging-symbolic;"
+ "gpm-battery-full;gpm-battery-100;"
+ "battery-full-charged;battery-full-charging");
+
+ // charging battery, 95%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0,
+ NULL);
+ check_icon_names (device, "battery-caution-charging-symbolic;"
+ "gpm-battery-000-charging;"
+ "battery-caution-charging");
+
+ // charging battery, 85%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0,
+ NULL);
+ check_icon_names (device, "battery-caution-charging-symbolic;"
+ "gpm-battery-000-charging;"
+ "battery-caution-charging");
+
+ // charging battery, 50%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ NULL);
+ check_icon_names (device, "battery-caution-charging-symbolic;"
+ "gpm-battery-000-charging;"
+ "battery-caution-charging");
+
+ // charging battery, 25%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
+ NULL);
+ check_icon_names (device, "battery-caution-charging-symbolic;"
+ "gpm-battery-000-charging;"
+ "battery-caution-charging");
+
+ // charging battery, 5%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0,
+ NULL);
+ check_icon_names (device, "battery-caution-charging-symbolic;"
+ "gpm-battery-000-charging;"
+ "battery-caution-charging");
+
+
+ // discharging battery, 95%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0,
+ NULL);
+ check_icon_names (device, "battery-full-symbolic;"
+ "gpm-battery-100;"
+ "battery-full");
+
+ // discharging battery, 85%
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0,
+ NULL);
+ check_icon_names (device, "battery-full-symbolic;"
+ "gpm-battery-080;"
+ "battery-full");
+
+ // discharging battery, 50% -- 1 hour left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
+ NULL);
+ check_icon_names (device, "battery-good-symbolic;"
+ "gpm-battery-060;"
+ "battery-good");
+
+ // discharging battery, 25% -- 1 hour left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
+ INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
+ NULL);
+ check_icon_names (device, "battery-good-symbolic;"
+ "gpm-battery-040;"
+ "battery-good");
+
+ // discharging battery, 25% -- 15 minutes left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
+ INDICATOR_POWER_DEVICE_TIME, (guint64)(60*15),
+ NULL);
+ check_icon_names (device, "battery-low-symbolic;"
+ "gpm-battery-020;"
+ "battery-low");
+
+ // discharging battery, 5% -- 1 hour left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0,
+ INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
+ NULL);
+ check_icon_names (device, "battery-good-symbolic;"
+ "gpm-battery-040;"
+ "battery-good");
+
+ // discharging battery, 5% -- 15 minutes left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0,
+ INDICATOR_POWER_DEVICE_TIME, (guint64)(60*15),
+ NULL);
+ check_icon_names (device, "battery-caution-symbolic;"
+ "gpm-battery-000;"
+ "battery-caution");
+ // state unknown
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_UNKNOWN,
+ NULL);
+ check_icon_names (device, "battery-missing-symbolic;"
+ "gpm-battery-missing;"
+ "battery-missing");
+
+ // cleanup
+ g_object_unref(o);
+}
+
+
+TEST_F(DeviceTest, Labels)
+{
+ // set our language so that i18n won't break these tests
+ char * real_lang = g_strdup(g_getenv ("LANG"));
+ g_setenv ("LANG", "en_US.UTF-8", TRUE);
+
+ // bad args: NULL device
+ check_strings (NULL, NULL, NULL, NULL);
+
+ // bad args: a GObject that isn't a device
+ GObject * o = G_OBJECT(g_cancellable_new());
+ check_strings ((IndicatorPowerDevice*)o, NULL, NULL, NULL);
+ g_object_unref (o);
+
+ /**
+ ***
+ **/
+
+ IndicatorPowerDevice * device = INDICATOR_POWER_DEVICE (g_object_new (INDICATOR_POWER_DEVICE_TYPE, NULL));
+ o = G_OBJECT(device);
+
+ // charging
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*61),
+ NULL);
+ check_strings (device, "(1:01)",
+ "Battery (1:01 to charge)",
+ "Battery (1 hour 1 minute to charge (50%))");
+
+ // discharging, < 12 hours left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*61),
+ NULL);
+ check_strings (device, "1:01",
+ "Battery (1:01 left)",
+ "Battery (1 hour 1 minute left (50%))");
+
+ // discharging, > 12 hours left
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60*13),
+ NULL);
+ check_strings (device, "13:00", "Battery", "Battery");
+
+ // fully charged
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_FULLY_CHARGED,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 100.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ check_strings (device, "", "Battery (charged)", "Battery (charged)");
+
+ // percentage but no time estimate
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ check_strings (device, "(50%)", "Battery (50%)", "Battery (50%)");
+
+ // no percentage, no time estimate
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 0.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ check_strings (device, "(not present)", "Battery (not present)", "Battery (not present)");
+
+ // power line
+ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_LINE_POWER,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_UNKNOWN,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 0.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ check_strings (device, "AC Adapter", "AC Adapter", "AC Adapter");
+
+ // cleanup
+ g_object_unref(o);
+ g_setenv ("LANG", real_lang, TRUE);
+ g_free (real_lang);
+}
diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc
new file mode 100644
index 0000000..b9f7321
--- /dev/null
+++ b/tests/test-indicator.cc
@@ -0,0 +1,312 @@
+/*
+Copyright 2012 Canonical Ltd.
+
+Authors:
+ Charles Kerr <charles.kerr@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <gtest/gtest.h>
+
+#include "dbus-listener.h"
+#include "device.h"
+#include "indicator-power.h"
+
+/***
+****
+***/
+
+namespace
+{
+ void ensure_glib_initialized ()
+ {
+ static bool initialized = false;
+
+ if (G_UNLIKELY(!initialized))
+ {
+ initialized = true;
+ g_type_init();
+ }
+ }
+}
+
+/***
+****
+***/
+
+class IndicatorTest : public ::testing::Test
+{
+ protected:
+
+ IndicatorPowerDevice * ac_device;
+ IndicatorPowerDevice * battery_device;
+
+ virtual void SetUp()
+ {
+ ensure_glib_initialized ();
+
+ g_setenv( "GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE);
+
+ ac_device = indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/line_power_AC",
+ UP_DEVICE_KIND_LINE_POWER,
+ 0.0, UP_DEVICE_STATE_UNKNOWN, 0);
+
+ battery_device = indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/battery_BAT0",
+ UP_DEVICE_KIND_BATTERY,
+ 52.871712, UP_DEVICE_STATE_DISCHARGING, 8834);
+ }
+
+ virtual void TearDown()
+ {
+ g_object_unref (battery_device);
+ g_object_unref (ac_device);
+ }
+
+ const char* GetAccessibleDesc (IndicatorPower * power) const
+ {
+ GList * entries = indicator_object_get_entries (INDICATOR_OBJECT(power));
+ g_assert (g_list_length(entries) == 1);
+ IndicatorObjectEntry * entry = static_cast<IndicatorObjectEntry*>(entries->data);
+ const char * ret = entry->accessible_desc;
+ g_list_free (entries);
+ return ret;
+ }
+};
+
+/***
+****
+***/
+
+TEST_F(IndicatorTest, GObjectNew)
+{
+ GObject * o = G_OBJECT (g_object_new (INDICATOR_POWER_TYPE, NULL));
+ ASSERT_TRUE (o != NULL);
+ ASSERT_TRUE (IS_INDICATOR_POWER(o));
+ g_object_run_dispose (o); // used to get coverage of both branches in the object's dispose func's g_clear_*() calls
+ g_object_unref (o);
+}
+
+TEST_F(IndicatorTest, SetDevices)
+{
+ GSList * devices;
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+
+ devices = NULL;
+ devices = g_slist_append (devices, ac_device);
+ devices = g_slist_append (devices, battery_device);
+ indicator_power_set_devices (power, devices);
+ g_slist_free (devices);
+
+ g_object_unref (power);
+}
+
+TEST_F(IndicatorTest, DischargingStrings)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+ GSList * devices = g_slist_append (NULL, battery_device);
+
+ // give the indicator a discharging battery with 30 minutes of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*30),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (30 minutes left (50%))");
+
+ // give the indicator a discharging battery with 1 hour of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (1 hour left (50%))");
+
+ // give the indicator a discharging battery with 2 hours of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 100.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60*2),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (2 hours left (100%))");
+
+ // give the indicator a discharging battery with over 12 hours of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60*12 + 1),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery");
+
+ // give the indicator a discharging battery with 29 seconds left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_TIME, guint64(29),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (Unknown time left (100%))");
+
+ // what happens if the time estimate isn't available
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (50%)");
+
+ // what happens if the time estimate AND percentage isn't available
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 0.0,
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (not present)");
+
+ // cleanup
+ g_slist_free (devices);
+ g_object_unref (power);
+}
+
+TEST_F(IndicatorTest, ChargingStrings)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+ GSList * devices = g_slist_prepend (NULL, battery_device);
+
+ // give the indicator a discharging battery with 1 hour of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (1 hour to charge (50%))");
+
+ // give the indicator a discharging battery with 2 hours of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60*2),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (2 hours to charge (50%))");
+
+ // cleanup
+ g_slist_free (devices);
+ g_object_unref (power);
+}
+
+TEST_F(IndicatorTest, ChargedStrings)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+ GSList * devices = g_slist_append (NULL, battery_device);
+
+ // give the indicator a discharging battery with 1 hour of life left
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_FULLY_CHARGED,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 100.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (charged)");
+
+ // cleanup
+ g_slist_free (devices);
+ g_object_unref (power);
+}
+
+TEST_F(IndicatorTest, AvoidChargingBatteriesWithZeroSecondsLeft)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+
+ g_object_set (battery_device,
+ INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_FULLY_CHARGED,
+ INDICATOR_POWER_DEVICE_PERCENTAGE, 100.0,
+ INDICATOR_POWER_DEVICE_TIME, guint64(0),
+ NULL);
+ IndicatorPowerDevice * bad_battery_device = indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/battery_BAT0",
+ UP_DEVICE_KIND_BATTERY,
+ 53, UP_DEVICE_STATE_CHARGING, 0);
+
+ GSList * devices = NULL;
+ devices = g_slist_append (devices, battery_device);
+ devices = g_slist_append (devices, bad_battery_device);
+ indicator_power_set_devices (power, devices);
+ ASSERT_STREQ (GetAccessibleDesc(power), "Battery (53%)");
+
+ // cleanup
+ g_slist_free (devices);
+ g_object_unref (power);
+ g_object_unref (bad_battery_device);
+}
+
+TEST_F(IndicatorTest, OtherDevices)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+
+ g_object_ref (battery_device);
+ GSList * devices = g_slist_append (NULL, battery_device);
+
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/mouse", UP_DEVICE_KIND_MOUSE,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/ups", UP_DEVICE_KIND_UPS,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/keyboard", UP_DEVICE_KIND_KEYBOARD,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/pda", UP_DEVICE_KIND_PDA,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/phone", UP_DEVICE_KIND_PHONE,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/monitor", UP_DEVICE_KIND_MONITOR,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/media_player", UP_DEVICE_KIND_MEDIA_PLAYER,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/tablet", UP_DEVICE_KIND_TABLET,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/computer", UP_DEVICE_KIND_COMPUTER,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+ devices = g_slist_append (devices, indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/unknown", UP_DEVICE_KIND_UNKNOWN,
+ 0, UP_DEVICE_STATE_UNKNOWN, 0));
+
+ indicator_power_set_devices (power, devices);
+
+ // FIXME: this tests to confirm the code doesn't crash,
+ // but further tests would be helpful
+
+ // cleanup
+ g_slist_free_full (devices, g_object_unref);
+ g_object_unref (power);
+}
+
+TEST_F(IndicatorTest, NoDevices)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+
+ indicator_power_set_devices (power, NULL);
+
+ // FIXME: this tests to confirm the code doesn't crash,
+ // but further tests would be helpful
+
+ // cleanup
+ g_object_unref (power);
+}