Skip to content

Commit 0db0752

Browse files
committed
tests: Add a test for screenshot ref commit behaviour
1 parent 564824e commit 0db0752

File tree

6 files changed

+106
-1
lines changed

6 files changed

+106
-1
lines changed

tests/Makefile.am.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ dist_installed_test_data = \
5858
tests/org.test.Deprecated.SHA1.file.yaml \
5959
tests/hello.sh \
6060
tests/hello.tar.xz \
61+
tests/org.flatpak_builder.gui.desktop \
62+
tests/org.flatpak_builder.gui.json \
63+
tests/org.flatpak_builder.gui.metainfo.xml \
6164
$(NULL)
6265

6366
installed_test_keyringdir = $(installed_testdir)/test-keyring

tests/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ if get_option('installed_tests')
105105
'test-runtime.json',
106106
'test.json',
107107
'test.yaml',
108+
'tests/org.flatpak_builder.gui.desktop',
109+
'tests/org.flatpak_builder.gui.json',
110+
'tests/org.flatpak_builder.gui.metainfo.xml',
108111

109112
install_dir: installed_testdir,
110113
install_mode: 'rw-r--r--',
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Desktop Entry]
2+
Name=Example
3+
GenericName=Example
4+
Comment=Example
5+
Exec=hello %U
6+
Icon=org.flatpak_builder.gui
7+
Type=Application
8+
Categories=Network;
9+
Version=1.1

tests/org.flatpak_builder.gui.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "org.flatpak_builder.gui",
3+
"runtime": "org.test.Platform",
4+
"sdk": "org.test.Sdk",
5+
"command": "hello",
6+
"modules": [
7+
{
8+
"name": "hello_gui",
9+
"buildsystem": "simple",
10+
"build-commands": [
11+
"mkdir -p ${FLATPAK_DEST}/bin ${FLATPAK_DEST}/share/metainfo ${FLATPAK_DEST}/share/applications",
12+
"mkdir -p ${FLATPAK_DEST}/share/icons/hicolor/64x64/apps",
13+
"cp -vf hello.sh ${FLATPAK_DEST}/bin/hello",
14+
"cp -vf ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml",
15+
"cp -vf ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop",
16+
"cp -vf org.test.Hello.png ${FLATPAK_DEST}/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.png"
17+
],
18+
"sources": [
19+
{
20+
"type": "script",
21+
"dest-filename": "hello.sh",
22+
"commands": [
23+
"echo \"Hello world, from a sandbox\""
24+
]
25+
},
26+
{
27+
"type": "file",
28+
"path": "org.flatpak_builder.gui.desktop"
29+
},
30+
{
31+
"type": "file",
32+
"path": "org.flatpak_builder.gui.metainfo.xml"
33+
},
34+
{
35+
"type": "file",
36+
"path": "org.test.Hello.png"
37+
}
38+
]
39+
}
40+
]
41+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>org.flatpak_builder.gui</id>
4+
<launchable type="desktop-id">org.flatpak_builder.gui.desktop</launchable>
5+
<metadata_license>CC0-1.0</metadata_license>
6+
<project_license>GPL-2.0+</project_license>
7+
<name>org.flatpak_builder.gui</name>
8+
<developer_name>Flatpak</developer_name>
9+
<summary>Foo foo foo foo</summary>
10+
<url type="homepage">https://flatpak.org</url>
11+
<description>
12+
<p>An example desktop application</p>
13+
</description>
14+
<screenshots>
15+
<!-- appstream silently continues without error if the file fails to
16+
download. since the tag only accepts http(s) urls, we add
17+
multiple sources so that in case one link fails, at least one
18+
of the other ones work. Replace with any other screenshot
19+
link if it fails
20+
-->
21+
<screenshot type="default">
22+
<caption>An example screenshot</caption>
23+
<image>https://raw.githubusercontent.com/flatpak/flatpak.github.io/0b56895e271bbcc7f86f9570933a96adff99e110/source/img/endless-apps.original.png</image>
24+
</screenshot>
25+
<screenshot>
26+
<caption>An example screenshot</caption>
27+
<image>https://docs.flathub.org/img/card.png</image>
28+
</screenshot>
29+
</screenshots>
30+
<url type="bugtracker">https://flatpak.org</url>
31+
<content_rating type="oars-1.1"/>
32+
<releases>
33+
<release version="0.0.1" date="2020-08-28"/>
34+
</releases>
35+
</component>

tests/test-builder.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -euo pipefail
2323

2424
skip_without_fuse
2525

26-
echo "1..7"
26+
echo "1..8"
2727

2828
setup_repo
2929
install_repo
@@ -49,6 +49,10 @@ cp $(dirname $0)/Hello-desktop.appdata.xml .
4949
cp $(dirname $0)/org.test.Hello.desktop .
5050
cp $(dirname $0)/org.test.Hello.xml .
5151
cp $(dirname $0)/org.test.Hello.appdata.xml .
52+
cp $(dirname $0)/org.flatpak_builder.gui.desktop .
53+
cp $(dirname $0)/org.flatpak_builder.gui.json .
54+
cp $(dirname $0)/org.flatpak_builder.gui.metainfo.xml .
55+
cp $(dirname $0)/org.test.Hello.png .
5256
mkdir include1
5357
cp $(dirname $0)/module1.json include1/
5458
cp $(dirname $0)/module1.yaml include1/
@@ -127,3 +131,13 @@ ${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean runtimedir \
127131
test-runtime.json >&2
128132

129133
echo "ok runtime build cleanup with build-args"
134+
135+
# test screenshot ref commit
136+
${FLATPAK_BUILDER} --repo=$REPO/repo_sc --force-clean builddir_sc \
137+
--mirror-screenshots-url=https://example.org/media \
138+
org.flatpak_builder.gui.json >&2
139+
ostree --repo=$REPO/repo_sc refs|grep -Eq "^screenshots/$(flatpak --default-arch)$"
140+
ostree checkout --repo=$REPO/repo_sc -U screenshots/$(flatpak --default-arch) outdir_sc
141+
find outdir_sc -path "*/screenshots/image-1_orig.png" -type f | grep -q .
142+
143+
echo "ok screenshot ref commit"

0 commit comments

Comments
 (0)