From 69c22237a47647a66ce6c5f47b4fe8009e02fea4 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 7 Dec 2017 19:00:30 +0100 Subject: [PATCH] Add a test for mimehandler_get_types() --- tests/applications/Widget.desktop | 5 +++++ tests/mimehandler.c | 16 ++++++++++++++++ tests/project.conf | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 tests/applications/Widget.desktop diff --git a/tests/applications/Widget.desktop b/tests/applications/Widget.desktop new file mode 100644 index 0000000..9114f30 --- /dev/null +++ b/tests/applications/Widget.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Name=Widget +Exec=widget +MimeTypes= diff --git a/tests/mimehandler.c b/tests/mimehandler.c index 78e57b5..d658dac 100644 --- a/tests/mimehandler.c +++ b/tests/mimehandler.c @@ -39,6 +39,7 @@ int main(void) { MimeHandler * handler; char * path; + String ** types; if((path = getcwd(NULL, 0)) == NULL) return 2; @@ -55,6 +56,21 @@ int main(void) mimehandler_delete(handler); return 5; } + if(mimehandler_get_types(handler) != NULL) + { + mimehandler_delete(handler); + return 6; + } + mimehandler_delete(handler); + if((handler = mimehandler_new_load("Widget")) == NULL) + return 7; + if((types = mimehandler_get_types(handler)) == NULL + || types[0] != NULL) + { + mimehandler_delete(handler); + return 8; + } + free(types); mimehandler_delete(handler); return 0; } diff --git a/tests/project.conf b/tests/project.conf index f135db3..932cc6d 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -8,7 +8,7 @@ ldflags_force=`pkg-config --libs libSystem gtk+-2.0` $(OBJDIR)../src/libDesktop. #for Gtk+ 3 #cflags_force=`pkg-config --cflags libSystem gtk+-3.0` #ldflags_force=`pkg-config --libs libSystem gtk+-3.0` $(OBJDIR)../src/libDesktop.a -dist=Makefile,applications/Root.desktop,htmllint.sh,pkgconfig.sh,tests.sh,xmllint.sh +dist=Makefile,applications/Root.desktop,applications/Widget.desktop,htmllint.sh,pkgconfig.sh,tests.sh,xmllint.sh [htmllint.log] type=script @@ -18,7 +18,7 @@ depends=htmllint.sh [mimehandler] type=binary sources=mimehandler.c -depends=applications/Root.desktop +depends=applications/Root.desktop,applications/Widget.desktop [mimehandler.c] depends=../src/mimehandler.c