[totem/wip/hadess/remaining-time: 3/3] tests: Move test-time into test-totem



commit ffb4249237fb518655486fd7e1e8567d6c9acd7d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 19 04:10:11 2019 +0100

    tests: Move test-time into test-totem
    
    Along with the other time label tests.

 src/gst/meson.build | 12 -----------
 src/gst/test-time.c | 57 -----------------------------------------------------
 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/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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]