From a1af468373c982cb9a87ea6564c293b71306664b Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Fri, 07 Dec 2012 09:47:26 +0000 Subject: Add a test for the activities list palette It doesn't really test the resulting UI yet but even just constructing the widget can catch some bugs. Acked-by: Simon Schampijer --- diff --git a/Makefile.am b/Makefile.am index 9e252af..d024f44 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +TESTS_TMPDIR=$(abs_builddir)/tests-tmp + SUBDIRS = bin data po src extensions DISTCLEANFILES = \ @@ -12,3 +14,9 @@ EXTRA_DIST = \ intltool-extract.in DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb + +test: + cd $(top_srcdir)/tests && \ + mkdir -p $(TESTS_TMPDIR) && \ + TMPDIR=$(TESTS_TMPDIR) python -m unittest discover && \ + rm -rf $(TESTS_TMPDIR) diff --git a/tests/data/activity.svg b/tests/data/activity.svg new file mode 100644 index 0000000..8da7c63 --- /dev/null +++ b/tests/data/activity.svg @@ -0,0 +1,26 @@ + + +]> + + + + + + + + + + + + + + diff --git a/tests/test_activitieslist.py b/tests/test_activitieslist.py new file mode 100644 index 0000000..c5d13ab --- /dev/null +++ b/tests/test_activitieslist.py @@ -0,0 +1,49 @@ +# Copyright (C) 2012, Daniel Narvaez +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os +import unittest + +from jarabe.desktop.activitieslist import ActivityListPalette + +tests_dir = os.path.dirname(__file__) +data_dir = os.path.join(tests_dir, "data") + +class MockActivityInfo: + def get_bundle_id(self): + return "mock" + + def get_activity_version(self): + return 1 + + def get_is_favorite(self): + return False + + def get_icon(self): + return os.path.join(data_dir, "activity.svg") + + def get_name(self): + return "mock" + + def get_path(self): + return "mock" + + def is_user_activity(self): + return True + +class TestActivitiesList(unittest.TestCase): + def test_activity_list_palette(self): + palette = ActivityListPalette(MockActivityInfo()) -- cgit v0.9.1