Skip to content

Commit

Permalink
feat: add multiple fonts packages
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse committed Jul 20, 2023
1 parent 6dd1f81 commit a96c6c3
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 10 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/docker-drawio-desktop-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,32 @@ jobs:
- uses: rlespinasse/github-slug-action@v4
- name: Build docker image
run: make build
shell: bash
env:
DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }}
- name: Setup CI for test
run: make setup-test-on-ci
shell: bash
- name: Test docker image
run: |
make setup-test-on-ci
make test
run: make test-on-ci
shell: bash
env:
DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }}

- name: Test docker image // Store output logs
uses: actions/upload-artifact@v3
with:
name: test-docker-image-logs
path: "tests/output/*.log"
if: ${{ failure() }}
if: ${{ always() }}
- name: Test docker image // Store output files
uses: actions/upload-artifact@v3
with:
name: test-docker-image-files
path: |
tests/data
!tests/data/*.drawio
!tests/data/*/*.drawio
if: ${{ always() }}

release:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ node_modules/
output/
*.pdf
*.svg
!*-good.svg
*.png
!tests/expected/*.svg
!tests/expected/*.png
package-lock.json
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ RUN set -e; \
xvfb \
wget \
libgbm1 \
libasound2; \
wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb \
libasound2 \
# Fonts
fonts-liberation fonts-arphic-ukai fonts-arphic-uming fonts-noto fonts-noto-cjk fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core \
; wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb \
&& apt-get install -y /opt/drawio-desktop/drawio-amd64-${DRAWIO_VERSION}.deb \
&& rm -rf /opt/drawio-desktop/drawio-amd64-${DRAWIO_VERSION}.deb; \
apt-get remove -y wget; \
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ setup-test-on-ci:
@npm install bats
@sudo apt-get install -y libxml2-utils

test: cleanup build
test: cleanup build test-on-ci

test-on-ci:
@mkdir -p tests/output
@DOCKER_IMAGE=$(DOCKER_IMAGE) npx bats -r tests

cleanup:
@rm -rf tests/output
@rm -rf tests/data/*.pdf
@rm -rf tests/data/**/*.pdf
@rm -rf tests/data/*.svg
@rm -rf tests/data/**/*.svg
@rm -rf tests/data/*.png
@rm -rf tests/data/**/*.png
9 changes: 9 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ Other minor addition are available
* Add timeout capability since the application can hang sometimes (due to user action needed in GUI mode)
* Clear the output log from Electron Security Warning
* Disable auto-update functionality to avoid unneccessary log
* Multiple fonts from
** [fonts-liberation](https://packages.debian.org/bullseye/fonts-liberation)
** [fonts-arphic-ukai](https://packages.debian.org/bullseye/fonts-arphic-ukai)
** [fonts-arphic-uming](https://packages.debian.org/bullseye/fonts-arphic-uming)
** [fonts-noto](https://packages.debian.org/bullseye/fonts-noto)
** [fonts-noto-cjk](https://packages.debian.org/bullseye/fonts-noto-cjk)
** [fonts-ipafont-mincho](https://packages.debian.org/bullseye/fonts-ipafont-mincho)
** [fonts-ipafont-gothic](https://packages.debian.org/bullseye/fonts-ipafont-gothic)
** [fonts-unfonts-core](https://packages.debian.org/bullseye/fonts-unfonts-core)

== Running

Expand Down
22 changes: 22 additions & 0 deletions tests/data/fonts/chinese.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<mxfile host="app.diagrams.net" modified="2023-06-20T04:09:31.670Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" etag="e18gbWHugdKZuTiiPNY9" version="21.5.0" type="github">
<diagram name="第 1 页" id="it8AnUai0ouTSQVn7LDP">
<mxGraphModel dx="1434" dy="708" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="rcWM7fpsVE3WYOQHMuyr-1" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#F9F9F9;arcSize=4;shadow=0;strokeWidth=3;strokeColor=#F9F9F9;" vertex="1" parent="1">
<mxGeometry x="90" y="120" width="634" height="144" as="geometry" />
</mxCell>
<mxCell id="rcWM7fpsVE3WYOQHMuyr-2" value="&lt;font style=&quot;font-size: 15px&quot; face=&quot;Comic Sans MS&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;中文简体&lt;/span&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;shadow=0;strokeWidth=3;fillColor=#FFFFFF;strokeColor=#EEEEEE;fontColor=#5F39DD;fontStyle=1;gradientColor=#ffffff;" vertex="1" parent="1">
<mxGeometry x="133" y="179" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="rcWM7fpsVE3WYOQHMuyr-3" value="&lt;font style=&quot;font-size: 15px&quot; face=&quot;Comic Sans MS&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-weight: 400;&quot;&gt;繁體&lt;/span&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;shadow=0;strokeWidth=3;fillColor=#FFFFFF;strokeColor=#EEEEEE;fontColor=#5F39DD;fontStyle=1;gradientColor=#ffffff;" vertex="1" parent="1">
<mxGeometry x="333" y="179" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="rcWM7fpsVE3WYOQHMuyr-4" value="&lt;font style=&quot;font-size: 15px&quot; face=&quot;Comic Sans MS&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-weight: normal&quot;&gt;中英文&lt;/span&gt;&lt;br&gt;GraphSQL&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;shadow=0;strokeWidth=3;fillColor=#FFFFFF;strokeColor=#EEEEEE;fontColor=#5F39DD;fontStyle=1;gradientColor=#ffffff;" vertex="1" parent="1">
<mxGeometry x="533" y="179" width="120" height="60" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added tests/expected/fonts-chinese.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
8 changes: 8 additions & 0 deletions tests/fonts.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bats

. tests/base.bats

@test "Fonts chinese" {
docker_test "" 0 "export-fonts-chinese" "tests/data" -x -f png fonts/chinese.drawio
diff tests/expected/fonts-chinese.png tests/data/fonts/chinese.png
}
2 changes: 1 addition & 1 deletion tests/issue-20.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

@test "Issue 20 - frame bug / svg" {
docker_test "" 0 "export-issue-20" "tests/data" -x -f svg issue-20/frame-bug.drawio
diff <(xmllint --format tests/data/issue-20/frame-bug-good.svg) <(xmllint --format tests/data/issue-20/frame-bug.svg)
diff <(xmllint --format tests/expected/issue-20-frame-bug.svg) <(xmllint --format tests/data/issue-20/frame-bug.svg)
}

0 comments on commit a96c6c3

Please sign in to comment.