/* * Copyright (C) 2016 J. Ali Harlow * * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include #include #include static void test_basic(void) { gchar *cwd; cwd=g_get_current_dir(); g_setenv("PLOVER_ICONS_DATADIR",cwd,TRUE); g_free(cwd); plover_icons_add_to_stock("mimetypes", "application-x-redhat-package-manager"); g_assert(gtk_icon_factory_lookup_default("application-x-redhat-package-manager")); g_unsetenv("PLOVER_ICONS_DATADIR"); } static void test_no_svg(void) { gchar *cwd; cwd=g_get_current_dir(); g_setenv("PLOVER_ICONS_DATADIR",cwd,TRUE); g_free(cwd); g_setenv("PLOVER_IGNORE_SVG_SUPPORT","yes",TRUE); plover_icons_add_to_stock("mimetypes", "application-x-redhat-package-manager"); g_assert(gtk_icon_factory_lookup_default("application-x-redhat-package-manager")); g_unsetenv("PLOVER_IGNORE_SVG_SUPPORT"); g_unsetenv("PLOVER_ICONS_DATADIR"); } static void test_none_existant(void) { plover_icons_add_to_stock("mimetypes", "application-x-plover-test-stockicons"); } int main(int argc,char **argv) { int retval; gtk_test_init(&argc,&argv,NULL); g_test_bug_base("mailto:ali@juiblex.co.uk"); g_test_add_func("/stockicons/basic",test_basic); g_test_add_func("/stockicons/no-svg",test_no_svg); g_test_add_func("/stockicons/non-existant",test_none_existant); retval=g_test_run(); return retval; }