Commit 6078da64 authored by Carlos Soriano 's avatar Carlos Soriano

Merge branch 'broken-tests-not-anymore' into 'master'

tests: update common filename prefix test

See merge request !54
parents 3d0b63c6 6bc3255f
Pipeline #1844 passed with stage
in 5 minutes and 45 seconds
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
#include <eel/eel-background.h>
#include <gtk/gtk.h>
#define PATTERNS_DIR "/gnome-source/eel/data/patterns"
int
main (int argc,
char *argv[])
{
GtkWidget *window;
EelBackground *background;
char *image_uri;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
gtk_main_quit, NULL);
background = eel_get_widget_background (window);
eel_background_set_color (background,
"red-blue:h");
image_uri = g_filename_to_uri (PATTERNS_DIR "/50s.png", NULL, NULL);
#if 1
eel_background_set_image_uri (background, image_uri);
#endif
g_free (image_uri);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
......@@ -132,21 +132,6 @@ test_doesnt_have_large_enough_common_prefix_first_character_differs_longer_strin
free_list_and_result (list, actual);
}
static void
test_has_large_enough_common_prefix_until_punctuation_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "tes$%^");
list = g_list_append (list, "tes$%something");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_null (actual);
free_list_and_result (list, actual);
}
static void
test_has_large_enough_common_prefix_until_extension_removed ()
{
......@@ -162,21 +147,6 @@ test_has_large_enough_common_prefix_until_extension_removed ()
free_list_and_result (list, actual);
}
static void
test_has_large_enough_common_prefix_until_extension_and_punctuation_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "tux$&&&.txt");
list = g_list_append (list, "tux$&&&.tar");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_null (actual);
free_list_and_result (list, actual);
}
static void
test_extension_is_removed ()
{
......@@ -192,21 +162,6 @@ test_extension_is_removed ()
free_list_and_result (list, actual);
}
static void
test_punctuation_is_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "nautilus((&&£");
list = g_list_append (list, "nautilus((&&xyz");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("nautilus", ==, actual);
free_list_and_result (list, actual);
}
static void
test_whitespace_is_removed ()
{
......@@ -223,61 +178,31 @@ test_whitespace_is_removed ()
}
static void
test_punctuation_and_whitespace_are_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "nautilus! £ $\"TTR");
list = g_list_append (list, "nautilus! £ $\"");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("nautilus", ==, actual);
free_list_and_result (list, actual);
}
static void
test_whitespace_and_punctuation_are_removed ()
test_whitespace_and_extension_are_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "nautilus !£ $\"TTR");
list = g_list_append (list, "nautilus !£ $\"");
list = g_list_append (list, "nautilus !£ $\" foo.tar.gz");
list = g_list_append (list, "nautilus !£ $\" .lzma");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("nautilus", ==, actual);
free_list_and_result (list, actual);
}
static void
test_puctuation_and_extension_are_removed ()
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "nautilus!£$%^&*()_+-={}[];':@#~<>?,./\".tar");
list = g_list_append (list, "nautilus!£$%^&*()_+-={}[];':@#~<>?,./\".tat");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("nautilus", ==, actual);
g_assert_cmpstr ("nautilus !£ $\"", ==, actual);
free_list_and_result (list, actual);
}
static void
test_puctuation_extension_and_whitespace_are_removed ()
test_punctuation_is_preserved (void)
{
GList *list = NULL;
char *actual;
list = g_list_append (list, "nautilus!£$%^&* ()_+-={}[ ];':@#~<>?,./\".tar");
list = g_list_append (list, "nautilus!£$%^&* ()_+-={}[ ];':@#~<>?,./\".tat");
list = g_list_append (list, "nautilus (2018!£$%^&* ()_+-={}[ ];':@#~<>?,./\".mp4");
list = g_list_append (list, "nautilus (2018!£$%^&* ()_+-={}[ ];':@#~<>?,./\".srt");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("nautilus", ==, actual);
g_assert_cmpstr ("nautilus (2018!£$%^&* ()_+-={}[ ];':@#~<>?,./\"", ==, actual);
free_list_and_result (list, actual);
}
......@@ -352,7 +277,7 @@ test_unicode_with_punctuation ()
list = g_list_append (list, "ǣȸʸ- ͻͻΎΘ$%%&");
actual = nautilus_get_common_filename_prefix_from_filenames (list, 4);
g_assert_cmpstr ("ǣȸʸ- ͻͻΎΘ", ==, actual);
g_assert_cmpstr ("ǣȸʸ- ͻͻΎΘ$%%", ==, actual);
free_list_and_result (list, actual);
}
......@@ -485,26 +410,16 @@ setup_test_suite ()
test_doesnt_have_large_enough_common_prefix_first_character_differs_longer_string);
g_test_add_func ("/get-common-filename-prefix/3.0",
test_has_large_enough_common_prefix_until_punctuation_removed);
g_test_add_func ("/get-common-filename-prefix/3.1",
test_has_large_enough_common_prefix_until_extension_removed);
g_test_add_func ("/get-common-filename-prefix/3.2",
test_has_large_enough_common_prefix_until_extension_and_punctuation_removed);
g_test_add_func ("/get-common-filename-prefix/4.0",
test_extension_is_removed);
g_test_add_func ("/get-common-filename-prefix/4.1",
test_punctuation_is_removed);
g_test_add_func ("/get-common-filename-prefix/4.2",
test_whitespace_is_removed);
g_test_add_func ("/get-common-filename-prefix/4.2",
test_whitespace_and_extension_are_removed);
g_test_add_func ("/get-common-filename-prefix/4.3",
test_punctuation_and_whitespace_are_removed);
g_test_add_func ("/get-common-filename-prefix/4.4",
test_whitespace_and_punctuation_are_removed);
g_test_add_func ("/get-common-filename-prefix/4.5",
test_puctuation_and_extension_are_removed);
g_test_add_func ("/get-common-filename-prefix/4.6",
test_puctuation_extension_and_whitespace_are_removed);
test_punctuation_is_preserved);
g_test_add_func ("/get-common-filename-prefix/5.0",
test_unicode_on_inside);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment