summaryrefslogtreecommitdiff
path: root/test/endless
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2014-01-08 16:51:39 -0500
committerPhilip Chimento <philip@endlessm.com>2015-03-25 17:42:34 -0700
commit67c212e47a1db5f3e3dd1abaf552052e46512c93 (patch)
tree84d7d7906b033e502561c4136efeda68312cc6bc /test/endless
parent88a142a202a3ae5e82f222cbb5ce75372d66e719 (diff)
Initial implementation of image credits
This is a rough implementation of an "About"-like dialog for image attribution in SDK applications. You can press the 'secret' hotkey Shift+Ctrl+A to get a dialog with thumbnails and attribution information for the images in the app's GResource. Clicking on the thumbnail opens the image's original URI in the browser, if known. Clicking on the text opens the image's license text in the browser, if known. For this, you need to add a JSON file to the app's GResource and pass its GResource path to the EosApplication:image-attribution-file property. The format of this JSON file is described in the documentation for EosApplication. The dialog uses GtkTreeView because we didn't have GtkListBox when I started implementing it over a year ago. This places some limitations on the UI; the links behave weirdly and the mouse pointer doesn't change to a hand when hovering over the links. [endlessm/eos-sdk#2934]
Diffstat (limited to 'test/endless')
-rw-r--r--test/endless/test-application.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/endless/test-application.c b/test/endless/test-application.c
index bb31b8f..13a53b4 100644
--- a/test/endless/test-application.c
+++ b/test/endless/test-application.c
@@ -72,6 +72,29 @@ test_config_dir_get (UniqueAppFixture *fixture,
}
static void
+test_image_attribution_file_get_set (UniqueAppFixture *fixture,
+ gconstpointer unused)
+{
+ GFile *file1, *file2;
+ GFileIOStream *stream;
+ g_object_get (fixture->app, "image-attribution-file", &file1, NULL);
+
+ g_assert_null (file1);
+
+ file1 = g_file_new_tmp (NULL, &stream, NULL);
+ g_assert_nonnull (file1);
+ g_io_stream_close (G_IO_STREAM (stream), NULL, NULL);
+ g_object_unref (stream);
+ g_object_set (fixture->app, "image-attribution-file", file1, NULL);
+ g_object_get (fixture->app, "image-attribution-file", &file2, NULL);
+
+ g_assert_true (g_file_equal (file1, file2));
+
+ g_object_unref (file1);
+ g_object_unref (file2);
+}
+
+static void
test_config_dir_returns_expected_path (UniqueAppFixture *fixture,
gconstpointer unused)
{
@@ -156,6 +179,8 @@ add_application_tests (void)
unique_app_setup, (func), unique_app_teardown)
ADD_APP_TEST ("/application/config-dir-get", test_config_dir_get);
+ ADD_APP_TEST ("/application/image-attribution-file-get-set",
+ test_image_attribution_file_get_set);
ADD_APP_TEST ("/application/config-dir-expected-path",
test_config_dir_returns_expected_path);
ADD_APP_TEST ("/application/config-dir-exists", test_config_dir_exists);