Skip to content

Commit

Permalink
tests: Add a test for rename
Browse files Browse the repository at this point in the history
- install test icon in the proper directory
- added desktop file
  • Loading branch information
hfiguiere committed Oct 21, 2023
1 parent 77ccb2c commit 25ab1d4
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 7 deletions.
2 changes: 2 additions & 0 deletions tests/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ dist_installed_test_extra_scripts += \
dist_installed_test_data = \
tests/libtest.sh \
tests/org.test.Hello.png \
tests/org.test.Hello.desktop \
tests/source1.json \
tests/source2.json \
tests/test.json \
tests/test.yaml \
tests/test-rename.json \
tests/test-runtime.json \
tests/module1.json \
tests/module1.yaml \
Expand Down
2 changes: 2 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ if get_option('installed_tests')
'org.test.Deprecated.SHA1.file.json',
'org.test.Deprecated.SHA1.file.yaml',
'org.test.Hello.png',
'org.test.Hello.desktop',
'org.test.Python.json',
'org.test.Python2.json',
'session.conf.in',
'source1.json',
'source2.json',
'test-rename.json',
'test-runtime.json',
'test.json',
'test.yaml',
Expand Down
7 changes: 7 additions & 0 deletions tests/org.test.Hello.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Hello
Exec=hello2.sh
Icon=org.test.Hello
MimeType=x-test/Hello;
9 changes: 6 additions & 3 deletions tests/test-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -euo pipefail

skip_without_fuse

echo "1..5"
echo "1..6"

setup_repo
install_repo
Expand All @@ -36,10 +36,12 @@ cd $TEST_DATA_DIR/

cp -a $(dirname $0)/test-configure .
echo "version1" > app-data
cp $(dirname $0)/test-rename.json .
cp $(dirname $0)/test.json .
cp $(dirname $0)/test.yaml .
cp $(dirname $0)/test-runtime.json .
cp $(dirname $0)/0001-Add-test-logo.patch .
cp $(dirname $0)/org.test.Hello.desktop .
mkdir include1
cp $(dirname $0)/module1.json include1/
cp $(dirname $0)/module1.yaml include1/
Expand All @@ -53,7 +55,7 @@ cp $(dirname $0)/source2.json include1/include2/
cp $(dirname $0)/data2 include1/include2/
cp $(dirname $0)/data2.patch include1/include2/

for MANIFEST in test.json test.yaml ; do
for MANIFEST in test.json test.yaml test-rename.json ; do
echo "building manifest $MANIFEST" >&2
${FLATPAK_BUILDER} --repo=$REPO $FL_GPGARGS --force-clean appdir $MANIFEST >&2

Expand All @@ -67,7 +69,8 @@ for MANIFEST in test.json test.yaml ; do
assert_not_has_file appdir/files/bin/file.cleanup

assert_has_file appdir/files/cleaned_up > out
assert_has_file appdir/files/share/icons/org.test.Hello2.png
assert_has_file appdir/files/share/icons/hicolor/64x64/apps/org.test.Hello2.png
assert_has_file appdir/files/share/applications/org.test.Hello2.desktop

assert_file_has_content appdir/files/out '^foo$'
assert_file_has_content appdir/files/out2 '^foo2$'
Expand Down
97 changes: 97 additions & 0 deletions tests/test-rename.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"app-id": "org.test.Hello2",
"runtime": "org.test.Platform",
"sdk": "org.test.Sdk",
"command": "hello2.sh",
"tags": ["test"],
"token-type": 0,
"finish-args": [
"--share=network"
],
"rename-icon": "Hello",
"rename-desktop-file": "Hello.desktop",
"build-options" : {
"cflags": "-O2 -g",
"cxxflags": "-O2 -g",
"env": {
"FOO": "bar",
"V": "1"
}
},
"cleanup": ["/cleanup", "*.cleanup"],
"cleanup-commands": [ "touch /app/cleaned_up" ],
"modules": [
"include1/module1.json",
{
"name": "root",
"modules": [
{
"name": "test",
"config-opts": ["--some-arg"],
"post-install": [
"touch /app/bin/file.cleanup",
"mkdir -p /app/share/icons/hicolor/64x64/apps/",
"cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/Hello.png",
"mkdir -p /app/share/applications",
"cp org.test.Hello.desktop /app/share/applications/Hello.desktop"
],
"make-args": ["BAR=2" ],
"make-install-args": ["BAR=3" ],
"build-commands": [ "echo foo > /app/out" ],
"sources": [
{
"type": "file",
"path": "test-configure",
"dest-filename": "configure",
"sha256": "675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7"
},
{
"type": "file",
"path": "app-data"
},
{
"type": "file",
"path": "org.test.Hello.desktop"
},
{
"type": "script",
"dest-filename": "hello2.sh",
"commands": [ "echo \"Hello world2, from a sandbox\"" ]
},
{
"type": "shell",
"commands": [
"mkdir /app/cleanup/",
"touch /app/cleanup/a_file"
]
},
{
"type": "patch",
"path": "0001-Add-test-logo.patch",
"use-git": true
}
]
},
{
"name": "test2",
"build-commands": [
"echo foo2 > /app/out2",
"cp source[12] /app"
],
"buildsystem": "simple",
"sources": [
{
"type": "file",
"path": "app-data"
},
"include1/source1.json",
"include1/include2/source2.json"
]
},
{
"name": "empty"
}
]
}
]
}
10 changes: 8 additions & 2 deletions tests/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"config-opts": ["--some-arg"],
"post-install": [
"touch /app/bin/file.cleanup",
"mkdir -p /app/share/icons/",
"cp org.test.Hello.png /app/share/icons/$FLATPAK_ID.png"
"mkdir -p /app/share/icons/hicolor/64x64/apps/",
"cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/$FLATPAK_ID.png",
"mkdir -p /app/share/applications",
"cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop"
],
"make-args": ["BAR=2" ],
"make-install-args": ["BAR=3" ],
Expand All @@ -50,6 +52,10 @@
"dest-filename": "hello2.sh",
"commands": [ "echo \"Hello world2, from a sandbox\"" ]
},
{
"type": "file",
"path": "org.test.Hello.desktop"
},
{
"type": "shell",
"commands": [
Expand Down
8 changes: 6 additions & 2 deletions tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ modules:
config-opts: [--some-arg]
post-install:
- touch /app/bin/file.cleanup
- mkdir -p /app/share/icons/
- cp org.test.Hello.png /app/share/icons/$FLATPAK_ID.png
- mkdir -p /app/share/icons/hicolor/64x64/apps/
- cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/$FLATPAK_ID.png
- mkdir -p /app/share/applications
- cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop
make-args: [BAR=2]
make-install-args: [BAR=3]
build-commands: ['echo foo > /app/out']
Expand All @@ -37,6 +39,8 @@ modules:
- type: script
dest-filename: hello2.sh
commands: ['echo "Hello world2, from a sandbox"']
- type: file
path: org.test.Hello.desktop
- type: shell
commands:
- mkdir /app/cleanup/
Expand Down

0 comments on commit 25ab1d4

Please sign in to comment.