Skip to content

Commit c0d2b67

Browse files
committed
tests: Add a test for screenshot ref commit behaviour
1 parent 39e750b commit c0d2b67

File tree

7 files changed

+96
-0
lines changed

7 files changed

+96
-0
lines changed

tests/Makefile.am.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ 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 \
64+
tests/org.flatpak_builder.gui.svg \
6165
$(NULL)
6266

6367
installed_test_keyringdir = $(installed_testdir)/test-keyring

tests/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ 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',
111+
'tests/org.flatpak_builder.gui.svg',
108112

109113
install_dir: installed_testdir,
110114
install_mode: 'rw-r--r--',
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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
10+

tests/org.flatpak_builder.gui.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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",
9+
"buildsystem": "simple",
10+
"build-commands": [
11+
"install -Dm0755 hello.sh ${FLATPAK_DEST}/bin/hello",
12+
"install -Dm0644 ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml",
13+
"install -Dm0644 ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop",
14+
"install -Dm0644 ${FLATPAK_ID}.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg"
15+
],
16+
"sources": [
17+
{
18+
"type": "script",
19+
"dest-filename": "hello.sh",
20+
"commands": [
21+
"echo \"Hello world, from a sandbox\""
22+
]
23+
},
24+
{
25+
"type": "file",
26+
"path": "org.flatpak_builder.gui.desktop"
27+
},
28+
{
29+
"type": "file",
30+
"path": "org.flatpak_builder.gui.metainfo.xml"
31+
},
32+
{
33+
"type": "file",
34+
"path": "org.flatpak_builder.gui.svg"
35+
}
36+
]
37+
}
38+
]
39+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<screenshot type="default">
16+
<caption>An example screenshot</caption>
17+
<image>https://raw.githubusercontent.com/flatpak/flatpak.github.io/0b56895e271bbcc7f86f9570933a96adff99e110/source/img/endless-apps.original.png</image>
18+
</screenshot>
19+
</screenshots>
20+
<url type="bugtracker">https://flatpak.org</url>
21+
<content_rating type="oars-1.1"/>
22+
<releases>
23+
<release version="0.0.1" date="2020-08-28"/>
24+
</releases>
25+
</component>

tests/org.flatpak_builder.gui.svg

2.51 KB
Loading

tests/test-builder.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.flatpak_builder.gui.svg .
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 -E "^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" -exec test -f {} \; -quit
142+
143+
echo "ok tested screenshot ref"

0 commit comments

Comments
 (0)