Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
slapos
Commits
ac05b42a
Commit
ac05b42a
authored
Nov 29, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/cloudooo/test: snapshot test an odg to png conversion
So that we can see when something changes.
parent
20c0623a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
software/cloudooo/test/data/test.TestLibreofficeDrawToPNGConversion.test.odg
...est/data/test.TestLibreofficeDrawToPNGConversion.test.odg
+0
-0
software/cloudooo/test/data/test.TestLibreofficeDrawToPNGConversion.test.png
...est/data/test.TestLibreofficeDrawToPNGConversion.test.png
+0
-0
software/cloudooo/test/test.py
software/cloudooo/test/test.py
+24
-0
No files found.
software/cloudooo/test/data/test.TestLibreofficeDrawToPNGConversion.test.odg
0 → 100644
View file @
ac05b42a
File added
software/cloudooo/test/data/test.TestLibreofficeDrawToPNGConversion.test.png
0 → 100644
View file @
ac05b42a
59.7 KB
software/cloudooo/test/test.py
View file @
ac05b42a
...
@@ -37,9 +37,12 @@ import base64
...
@@ -37,9 +37,12 @@ import base64
import
io
import
io
import
requests
import
requests
import
PIL.Image
import
PyPDF2
import
PyPDF2
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.utils
import
ImageComparisonTestCase
setUpModule
,
_CloudOooTestCase
=
makeModuleSetUpAndTestCaseClass
(
setUpModule
,
_CloudOooTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
abspath
(
...
@@ -246,6 +249,27 @@ class TestLibreoffice(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
...
@@ -246,6 +249,27 @@ class TestLibreoffice(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
).
encode
())
).
encode
())
class
TestLibreofficeDrawToPNGConversion
(
CloudOooTestCase
,
ImageComparisonTestCase
):
__partition_reference__
=
'l'
def
test
(
self
):
reference_png
=
PIL
.
Image
.
open
(
os
.
path
.
join
(
'data'
,
f'
{
self
.
id
()
}
.png'
))
with
open
(
os
.
path
.
join
(
'data'
,
f'
{
self
.
id
()
}
.odg'
),
'rb'
)
as
f
:
actual_png_data
=
base64
.
decodebytes
(
self
.
server
.
convertFile
(
base64
.
encodebytes
(
f
.
read
()).
decode
(),
'odg'
,
'png'
,
).
encode
())
actual_png
=
PIL
.
Image
.
open
(
io
.
BytesIO
(
actual_png_data
))
# save a snapshot
with
open
(
os
.
path
.
join
(
self
.
computer_partition_root_path
,
self
.
id
()
+
'.png'
),
'wb'
)
as
f
:
f
.
write
(
actual_png_data
)
self
.
assertImagesSame
(
actual_png
,
reference_png
)
class
TestLibreOfficeTextConversion
(
CloudOooTestCase
):
class
TestLibreOfficeTextConversion
(
CloudOooTestCase
):
__partition_reference__
=
'txt'
__partition_reference__
=
'txt'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment