summaryrefslogtreecommitdiff
path: root/test/smoke-tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/smoke-tests')
-rw-r--r--test/smoke-tests/Makefile.am.inc15
-rw-r--r--test/smoke-tests/credits.js44
-rw-r--r--test/smoke-tests/images/Fahrradrheinpromenade.jpgbin0 -> 30304 bytes
-rw-r--r--test/smoke-tests/images/attribution.json27
-rw-r--r--test/smoke-tests/images/credits.gresource.xml10
-rw-r--r--test/smoke-tests/images/test1.jpgbin0 -> 91158 bytes
-rw-r--r--test/smoke-tests/images/test2.jpgbin0 -> 22951 bytes
-rw-r--r--test/smoke-tests/images/test3.jpgbin0 -> 60084 bytes
8 files changed, 96 insertions, 0 deletions
diff --git a/test/smoke-tests/Makefile.am.inc b/test/smoke-tests/Makefile.am.inc
index 2c0fba3..170b335 100644
--- a/test/smoke-tests/Makefile.am.inc
+++ b/test/smoke-tests/Makefile.am.inc
@@ -3,3 +3,18 @@
test_smoke_tests_hello_SOURCES = $(ENDLESS_TESTS_DIRECTORY)/smoke-tests/hello.c
test_smoke_tests_hello_CPPFLAGS = $(TEST_FLAGS)
test_smoke_tests_hello_LDADD = $(TEST_LIBS)
+
+credits_resource_files = \
+ test/smoke-tests/images/test1.jpg \
+ test/smoke-tests/images/test2.jpg \
+ test/smoke-tests/images/test3.jpg \
+ test/smoke-tests/images/attribution.json \
+ $(NULL)
+test/smoke-tests/images/credits.gresource: test/smoke-tests/images/credits.gresource.xml $(credits_resource_files)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/test/smoke-tests/images $<
+dist_noinst_DATA = test/smoke-tests/images/credits.gresource
+CLEANFILES += test/smoke-tests/images/credits.gresource
+EXTRA_DIST += \
+ test/smoke-tests/images/credits.gresource.xml \
+ $(credits_resource_files) \
+ $(NULL)
diff --git a/test/smoke-tests/credits.js b/test/smoke-tests/credits.js
new file mode 100644
index 0000000..5d4be70
--- /dev/null
+++ b/test/smoke-tests/credits.js
@@ -0,0 +1,44 @@
+const Endless = imports.gi.Endless;
+const GdkPixbuf = imports.gi.GdkPixbuf;
+const Gio = imports.gi.Gio;
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+
+const TestApp = new Lang.Class({
+ Name: 'TestApp',
+ Extends: Endless.Application,
+
+ vfunc_startup: function () {
+ this.parent();
+ let win = new TestWindow({ application: this });
+ win.show_all();
+ }
+});
+
+const TestWindow = new Lang.Class({
+ Name: 'TestWindow',
+ Extends: Endless.Window,
+
+ _init: function (props) {
+ this.parent(props);
+
+ let grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL });
+ ['test1', 'test2', 'test3', 'Fahrradrheinpromenade'].forEach((key) => {
+ let pixbuf = GdkPixbuf.Pixbuf.new_from_resource_at_scale('/com/example/attributiontest/' + key + '.jpg',
+ 200, -1, true);
+ let image = Gtk.Image.new_from_pixbuf(pixbuf);
+ grid.add(image);
+ });
+ this.page_manager.add(grid);
+ }
+});
+
+let resource = Gio.Resource.load(Endless.getCurrentFileDir() + '/images/credits.gresource');
+resource._register();
+
+let credits = Gio.File.new_for_uri('resource:///com/example/attributiontest/attribution.json');
+let app = new TestApp({
+ application_id: 'com.example.attribution',
+ image_attribution_file: credits
+});
+app.run(ARGV);
diff --git a/test/smoke-tests/images/Fahrradrheinpromenade.jpg b/test/smoke-tests/images/Fahrradrheinpromenade.jpg
new file mode 100644
index 0000000..396edba
--- /dev/null
+++ b/test/smoke-tests/images/Fahrradrheinpromenade.jpg
Binary files differ
diff --git a/test/smoke-tests/images/attribution.json b/test/smoke-tests/images/attribution.json
new file mode 100644
index 0000000..bfed553
--- /dev/null
+++ b/test/smoke-tests/images/attribution.json
@@ -0,0 +1,27 @@
+[
+ {
+ "resource_path": "/com/example/attributiontest/test2.jpg",
+ "license": "Public domain",
+ "uri": "http://www.flickr.com/photos/lsuc_archives/10613348833/",
+ "comment": "No known copyright restrictions"
+ },
+ {
+ "resource_path": "/com/example/attributiontest/test1.jpg",
+ "license_uri": "http://www.sxc.hu/txt/license.html",
+ "uri": "http://www.sxc.hu/browse.phtml?f=view&id=146768&rnd=1",
+ "credit": "cressida",
+ "credit_contact": "http://www.sxc.hu/profile/cressida"
+ },
+ {
+ "resource_path": "/com/example/attributiontest/test3.jpg",
+ "copyright_holder": "Philip Chimento",
+ "copyright_year": 2011,
+ "permission": true
+ },
+ {
+ "resource_path": "/com/example/attributiontest/Fahrradrheinpromenade.jpg",
+ "credit": "Florian Scholz",
+ "license": "CC BY 2.0",
+ "uri": "https://www.flickr.com/photos/fscholz/13540636975/"
+ }
+]
diff --git a/test/smoke-tests/images/credits.gresource.xml b/test/smoke-tests/images/credits.gresource.xml
new file mode 100644
index 0000000..51f1656
--- /dev/null
+++ b/test/smoke-tests/images/credits.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/com/example/attributiontest">
+ <file>test1.jpg</file>
+ <file>test2.jpg</file>
+ <file>test3.jpg</file>
+ <file>Fahrradrheinpromenade.jpg</file>
+ <file>attribution.json</file>
+ </gresource>
+</gresources>
diff --git a/test/smoke-tests/images/test1.jpg b/test/smoke-tests/images/test1.jpg
new file mode 100644
index 0000000..f9fd56a
--- /dev/null
+++ b/test/smoke-tests/images/test1.jpg
Binary files differ
diff --git a/test/smoke-tests/images/test2.jpg b/test/smoke-tests/images/test2.jpg
new file mode 100644
index 0000000..e75380e
--- /dev/null
+++ b/test/smoke-tests/images/test2.jpg
Binary files differ
diff --git a/test/smoke-tests/images/test3.jpg b/test/smoke-tests/images/test3.jpg
new file mode 100644
index 0000000..81056d0
--- /dev/null
+++ b/test/smoke-tests/images/test3.jpg
Binary files differ