[epiphany] Reenable test for ephy-file-helpers
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Reenable test for ephy-file-helpers
- Date: Sat, 29 Dec 2018 15:52:55 +0000 (UTC)
commit 9d54c68917754c743a9af1918801bd967646be73
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Fri Dec 21 11:47:24 2018 +0100
Reenable test for ephy-file-helpers
Fix ephy_file_get_downloads_dir () returning the wrong value for Desktop keys and reenable test for
ephy-file-helpers.
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/419
lib/ephy-file-helpers.c | 10 +++++-----
tests/ephy-file-helpers-test.c | 19 +++++++++++++------
tests/meson.build | 17 ++++++++---------
3 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 5cf2e81de..65313b915 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -141,6 +141,11 @@ ephy_file_get_downloads_dir (void)
download_dir = g_settings_get_string (EPHY_SETTINGS_STATE,
EPHY_PREFS_STATE_DOWNLOAD_DIR);
+ if (g_strcmp0 (download_dir, "Desktop") == 0) {
+ g_free (download_dir);
+ return ephy_file_desktop_dir ();
+ }
+
if (g_strcmp0 (download_dir, "Downloads") == 0 ||
!g_path_is_absolute (download_dir) ||
ephy_is_running_inside_flatpak ()) {
@@ -148,11 +153,6 @@ ephy_file_get_downloads_dir (void)
return ephy_file_download_dir ();
}
- if (g_strcmp0 (download_dir, "Desktop") == 0) {
- g_free (download_dir);
- return ephy_file_desktop_dir ();
- }
-
return download_dir;
}
diff --git a/tests/ephy-file-helpers-test.c b/tests/ephy-file-helpers-test.c
index 41f4a1084..44e6880a7 100644
--- a/tests/ephy-file-helpers-test.c
+++ b/tests/ephy-file-helpers-test.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "ephy-debug.h"
#include "ephy-file-helpers.h"
+#include "ephy-flatpak-utils.h"
#include "ephy-settings.h"
#include <glib.h>
@@ -102,22 +103,24 @@ typedef struct {
const char *key_value;
const char *expected;
GUserDirectory user_dir;
+ gboolean in_flatpak;
} DownloadsDirTest;
static const DownloadsDirTest downloads_tests[] =
{
- { "Desktop", NULL, G_USER_DIRECTORY_DESKTOP },
+ { "Desktop", NULL, G_USER_DIRECTORY_DESKTOP, TRUE },
- { "Downloads", NULL, G_USER_DIRECTORY_DOWNLOAD },
- { "invalid-keyword", NULL, G_USER_DIRECTORY_DOWNLOAD },
+ { "Downloads", NULL, G_USER_DIRECTORY_DOWNLOAD, TRUE },
+ { "invalid-keyword", NULL, G_USER_DIRECTORY_DOWNLOAD, TRUE },
- { "/tmp/Downloads", "/tmp/Downloads", -1 },
+ { "/tmp/Downloads", "/tmp/Downloads", -1, FALSE },
};
static void
test_ephy_file_get_downloads_dir (void)
{
guint i;
+ gboolean in_flatpak = ephy_is_running_inside_flatpak ();
ephy_file_helpers_init (NULL, EPHY_FILE_HELPERS_PRIVATE_PROFILE, NULL);
@@ -128,6 +131,9 @@ test_ephy_file_get_downloads_dir (void)
test = downloads_tests[i];
+ if (in_flatpak && !test.in_flatpak)
+ continue;
+
if (test.expected != NULL)
expected_dir = test.expected;
else
@@ -335,8 +341,9 @@ main (int argc, char *argv[])
g_test_add_func ("/lib/ephy-file-helpers/get_downloads_dir",
test_ephy_file_get_downloads_dir);
- g_test_add_func ("/lib/ephy-file-helpers/create_delete_dir",
- test_ephy_file_create_delete_dir);
+ if (!ephy_is_running_inside_flatpak ())
+ g_test_add_func ("/lib/ephy-file-helpers/create_delete_dir",
+ test_ephy_file_create_delete_dir);
g_test_add_func ("/lib/ephy-file-helpers/desktop_dir",
test_ephy_file_desktop_dir);
diff --git a/tests/meson.build b/tests/meson.build
index f9e425a6c..6294f4e92 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -55,15 +55,14 @@ if get_option('unit_tests')
env: envs
)
- # https://bugzilla.gnome.org/show_bug.cgi?id=786001
- # file_helpers_test = executable('test-ephy-file-helpers',
- # 'ephy-file-helpers-test.c',
- # dependencies: ephymain_dep
- # )
- # test('File helpers test',
- # file_helpers_test,
- # env: envs
- # )
+ file_helpers_test = executable('test-ephy-file-helpers',
+ 'ephy-file-helpers-test.c',
+ dependencies: ephymain_dep
+ )
+ test('File helpers test',
+ file_helpers_test,
+ env: envs
+ )
gsb_service_test = executable('test-ephy-gsb-service',
'ephy-gsb-service-test.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]