Skip to content

Commit

Permalink
tests: Test appdata rename
Browse files Browse the repository at this point in the history
Signed-off-by: Hubert Figuière <[email protected]>
  • Loading branch information
hfiguiere authored and TingPing committed Jan 22, 2024
1 parent 5028a40 commit 64bc5fb
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 3 deletions.
16 changes: 16 additions & 0 deletions tests/Hello.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>Hello.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>CC0-1.0</project_license>
<content_rating type="oars-1.1" />
<name>Hello</name>
<summary>Hello test app</summary>
<description>
<p>Just a test app</p>
</description>
<launchable type="desktop-id">Hello.desktop</launchable>
<releases>
<release version="2024.01.20" date="2024-01-20" />
</releases>
</component>
1 change: 1 addition & 0 deletions tests/Hello.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Name=Hello
Exec=hello2.sh
Icon=Hello
MimeType=x-test/Hello;
Categories=Utility;
16 changes: 16 additions & 0 deletions tests/org.test.Hello.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>org.test.Hello2</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>CC0-1.0</project_license>
<content_rating type="oars-1.1" />
<name>Hello</name>
<summary>Hello test app</summary>
<description>
<p>Just a test app</p>
</description>
<launchable type="desktop-id">org.test.Hello2.desktop</launchable>
<releases>
<release version="2024.01.20" date="2024-01-20" />
</releases>
</component>
1 change: 1 addition & 0 deletions tests/org.test.Hello.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Name=Hello
Exec=hello2.sh
Icon=org.test.Hello2
MimeType=x-test/Hello;
Categories=Utility;
5 changes: 4 additions & 1 deletion tests/test-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ cp $(dirname $0)/test-runtime.json .
cp $(dirname $0)/0001-Add-test-logo.patch .
cp $(dirname $0)/Hello.desktop .
cp $(dirname $0)/Hello.xml .
cp $(dirname $0)/Hello.appdata.xml .
cp $(dirname $0)/org.test.Hello.desktop .
cp $(dirname $0)/org.test.Hello.xml .
cp $(dirname $0)/org.test.Hello.appdata.xml .
mkdir include1
cp $(dirname $0)/module1.json include1/
cp $(dirname $0)/module1.yaml include1/
Expand Down Expand Up @@ -76,9 +78,10 @@ for MANIFEST in test.json test.yaml test-rename.json ; do
assert_has_file appdir/files/share/icons/hicolor/64x64/mimetypes/org.test.Hello2.application-x-hello.png
assert_has_file appdir/files/share/icons/hicolor/64x64/mimetypes/org.test.Hello2.application-x-goodbye.png
assert_has_file appdir/files/share/applications/org.test.Hello2.desktop
assert_has_file appdir/files/share/metainfo/org.test.Hello2.metainfo.xml

assert_has_file appdir/files/share/mime/packages/org.test.Hello2.xml
xmllint appdir/files/share/mime/packages/org.test.Hello2.xml >&2
xmllint --noout appdir/files/share/mime/packages/org.test.Hello2.xml >&2

assert_file_has_content appdir/files/out '^foo$'
assert_file_has_content appdir/files/out2 '^foo2$'
Expand Down
9 changes: 8 additions & 1 deletion tests/test-rename.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"--share=network"
],
"rename-icon": "Hello",
"rename-appdata-file": "Hello.appdata.xml",
"rename-desktop-file": "Hello.desktop",
"rename-mime-file": "Hello.xml",
"rename-mime-icons": [
Expand Down Expand Up @@ -43,7 +44,9 @@
"mkdir -p /app/share/applications",
"cp Hello.desktop /app/share/applications/",
"mkdir -p /app/share/mime/packages",
"cp Hello.xml /app/share/mime/packages/"
"cp Hello.xml /app/share/mime/packages/",
"mkdir -p /app/share/appdata",
"cp Hello.appdata.xml /app/share/appdata"
],
"make-args": ["BAR=2" ],
"make-install-args": ["BAR=3" ],
Expand All @@ -63,6 +66,10 @@
"type": "file",
"path": "Hello.desktop"
},
{
"type": "file",
"path": "Hello.appdata.xml"
},
{
"type": "file",
"path": "Hello.xml"
Expand Down
8 changes: 7 additions & 1 deletion tests/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"mkdir -p /app/share/applications",
"cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop",
"mkdir -p /app/share/mime/packages",
"cp org.test.Hello.xml /app/share/mime/packages/$FLATPAK_ID.xml"
"cp org.test.Hello.xml /app/share/mime/packages/$FLATPAK_ID.xml",
"mkdir -p /app/share/appdata",
"cp org.test.Hello.appdata.xml /app/share/appdata/$FLATPAK_ID.appdata.xml"
],
"make-args": ["BAR=2" ],
"make-install-args": ["BAR=3" ],
Expand All @@ -61,6 +63,10 @@
"type": "file",
"path": "org.test.Hello.desktop"
},
{
"type": "file",
"path": "org.test.Hello.appdata.xml"
},
{
"type": "file",
"path": "org.test.Hello.xml"
Expand Down
4 changes: 4 additions & 0 deletions tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ modules:
- cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop
- mkdir -p /app/share/mime/packages
- cp org.test.Hello.xml /app/share/mime/packages/$FLATPAK_ID.xml
- mkdir -p /app/share/appdata
- cp org.test.Hello.appdata.xml /app/share/appdata/$FLATPAK_ID.appdata.xml
make-args: [BAR=2]
make-install-args: [BAR=3]
build-commands: ['echo foo > /app/out']
Expand All @@ -46,6 +48,8 @@ modules:
commands: ['echo "Hello world2, from a sandbox"']
- type: file
path: org.test.Hello.desktop
- type: file
path: org.test.Hello.appdata.xml
- type: file
path: org.test.Hello.xml
- type: shell
Expand Down

0 comments on commit 64bc5fb

Please sign in to comment.