diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-02-19 04:10:11 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2019-02-19 04:38:37 +0100 |
commit | ffb4249237fb518655486fd7e1e8567d6c9acd7d (patch) | |
tree | eeaa1c35ac337c11e5035dca8a713c3c60418a9e /src | |
parent | d531ba6b163f294fc9de45f18b216458d4ab636c (diff) | |
download | totem-ffb4249237fb518655486fd7e1e8567d6c9acd7d.tar.gz |
tests: Move test-time into test-totem
Along with the other time label tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/gst/meson.build | 12 | ||||
-rw-r--r-- | src/gst/test-time.c | 57 | ||||
-rw-r--r-- | src/test-totem.c | 22 |
3 files changed, 22 insertions, 69 deletions
diff --git a/src/gst/meson.build b/src/gst/meson.build index 6ac3b0ab9..bfa9031b3 100644 --- a/src/gst/meson.build +++ b/src/gst/meson.build @@ -46,15 +46,3 @@ libtotem_time_helpers_dep = declare_dependency( include_directories: gst_inc, dependencies: glib_dep ) - -gst_test = 'test-time' - -exe = executable( - gst_test, - gst_test + '.c', - include_directories: top_inc, - dependencies: [ glib_dep, m_dep ], - link_with: libtotem_time_helpers -) - -test(gst_test, exe) diff --git a/src/gst/test-time.c b/src/gst/test-time.c deleted file mode 100644 index 8fd9f7748..000000000 --- a/src/gst/test-time.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Bastien Nocera <hadess@hadess.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#include <locale.h> -#include <glib.h> - -#include "totem-time-helpers.h" - -static void -test_time (void) -{ - g_assert_cmpstr (totem_time_to_string (0, FALSE, FALSE), ==, "0:00"); - g_assert_cmpstr (totem_time_to_string (500, FALSE, FALSE), ==, "0:00"); - g_assert_cmpstr (totem_time_to_string (500, TRUE, FALSE), ==, "-0:01"); - g_assert_cmpstr (totem_time_to_string (1250, FALSE, FALSE), ==, "0:01"); - g_assert_cmpstr (totem_time_to_string (1250, TRUE, FALSE), ==, "-0:02"); -} - -static void -log_handler (const char *log_domain, GLogLevelFlags log_level, const char *message, gpointer user_data) -{ - g_test_message ("%s", message); -} - -int -main (int argc, char *argv[]) -{ - setlocale (LC_ALL, "en_US.UTF-8"); - - g_test_init (&argc, &argv, NULL); - g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id="); - - /* We need to handle log messages produced by g_message so they're interpreted correctly by the GTester framework */ - g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, log_handler, NULL); - - g_test_add_func ("/time", test_time); - - return g_test_run (); -} diff --git a/src/test-totem.c b/src/test-totem.c index 7bfcfd762..3440dc5cd 100644 --- a/src/test-totem.c +++ b/src/test-totem.c @@ -4,6 +4,7 @@ #define GST_USE_UNSTABLE_API 1 #include <gst/tag/tag.h> +#include "gst/totem-time-helpers.h" #include "backend/bacon-video-widget.h" #include "backend/bacon-time-label.h" #include "totem-menu.h" @@ -104,6 +105,7 @@ static void test_time_label (void) { GtkWidget *label, *label_remaining; + char *str; label = bacon_time_label_new (); label_remaining = bacon_time_label_new (); @@ -132,6 +134,26 @@ test_time_label (void) set_labels (label, label_remaining, 50 * 60 * 1000, 45 * 60 * 1000, "50:00", "--:--"); + + str = totem_time_to_string (0, FALSE, FALSE); + g_assert_cmpstr (str, ==, "0:00"); + g_free (str); + + str = totem_time_to_string (500, FALSE, FALSE); + g_assert_cmpstr (str, ==, "0:01"); + g_free (str); + + str = totem_time_to_string (500, TRUE, FALSE); + g_assert_cmpstr (str, ==, "-0:01"); + g_free (str); + + str = totem_time_to_string (1250, FALSE, FALSE); + g_assert_cmpstr (str, ==, "0:01"); + g_free (str); + + str = totem_time_to_string (1250, TRUE, FALSE); + g_assert_cmpstr (str, ==, "-0:02"); + g_free (str); } int main (int argc, char **argv) |