ali@38: /* ali@38: * Copyright (C) 2016 J. Ali Harlow ali@38: * ali@38: * This program is free software; you can redistribute it and/or modify ali@38: * it under the terms of the GNU General Public License as published by ali@38: * the Free Software Foundation; either version 2 of the License, or ali@38: * (at your option) any later version. ali@38: * ali@38: * This program is distributed in the hope that it will be useful, ali@38: * but WITHOUT ANY WARRANTY; without even the implied warranty of ali@38: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ali@38: * GNU General Public License for more details. ali@38: * ali@38: * You should have received a copy of the GNU General Public License along ali@38: * with this program; if not, write to the Free Software Foundation, Inc., ali@38: * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ali@38: */ ali@38: ali@38: #include ali@38: #include ali@38: #include ali@38: #include ali@38: #include ali@38: #include ali@38: ali@38: static void test_basic(void) ali@38: { ali@38: gchar *cwd; ali@38: cwd=g_get_current_dir(); ali@38: g_setenv("PLOVER_ICONS_DATADIR",cwd,TRUE); ali@38: g_free(cwd); ali@38: plover_icons_add_to_stock("mimetypes", ali@38: "application-x-redhat-package-manager"); ali@38: g_assert(gtk_icon_factory_lookup_default("application-x-redhat-package-manager")); ali@38: g_unsetenv("PLOVER_ICONS_DATADIR"); ali@38: } ali@38: ali@38: static void test_no_svg(void) ali@38: { ali@38: gchar *cwd; ali@38: cwd=g_get_current_dir(); ali@38: g_setenv("PLOVER_ICONS_DATADIR",cwd,TRUE); ali@38: g_free(cwd); ali@38: g_setenv("PLOVER_IGNORE_SVG_SUPPORT","yes",TRUE); ali@38: plover_icons_add_to_stock("mimetypes", ali@38: "application-x-redhat-package-manager"); ali@38: g_assert(gtk_icon_factory_lookup_default("application-x-redhat-package-manager")); ali@38: g_unsetenv("PLOVER_IGNORE_SVG_SUPPORT"); ali@38: g_unsetenv("PLOVER_ICONS_DATADIR"); ali@38: } ali@38: ali@38: static void test_none_existant(void) ali@38: { ali@38: plover_icons_add_to_stock("mimetypes", ali@38: "application-x-plover-test-stockicons"); ali@38: } ali@38: ali@38: int main(int argc,char **argv) ali@38: { ali@38: int retval; ali@38: gtk_test_init(&argc,&argv,NULL); ali@38: g_test_bug_base("mailto:ali@juiblex.co.uk"); ali@38: g_test_add_func("/stockicons/basic",test_basic); ali@38: g_test_add_func("/stockicons/no-svg",test_no_svg); ali@38: g_test_add_func("/stockicons/non-existant",test_none_existant); ali@38: retval=g_test_run(); ali@38: return retval; ali@38: }