Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
a3789d48
Commit
a3789d48
authored
Oct 22, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core_test: add large svg convert test
parent
3fcd6237
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
...tTemplateItem/portal_components/test.erp5.testERP5Base.py
+26
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
View file @
a3789d48
...
...
@@ -36,6 +36,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
FileUpload
from
AccessControl.SecurityManagement
import
newSecurityManager
from
base64
import
b64encode
class
TestERP5Base
(
ERP5TypeTestCase
):
"""ERP5 Base tests.
...
...
@@ -923,6 +924,31 @@ class TestERP5Base(ERP5TypeTestCase):
return
thumbnail
.
getSize
()
self
.
assertTrue
(
convert
()
<
convert
(
quality
=
100
))
def
test_ConvertLargeSVG
(
self
):
image
=
self
.
portal
.
newContent
(
portal_type
=
'Image'
,
id
=
'test_image'
)
image
.
edit
(
file
=
self
.
makeImageFileUpload
(
'erp5_logo.png'
))
dataurl
=
b64encode
(
image
.
convert
(
format
=
"jpg"
,
display
=
"medium"
)[
1
])
svg_image
=
self
.
portal
.
newContent
(
portal_type
=
'Image'
,
id
=
'test_large_svg'
)
svg_content
=
'''
<svg width="580" height="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<title>background</title>
<rect fill="#fff" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
<g display="none" id="canvasGrid">
<rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%" id="svg_2"/>
</g>
</g>
<g>
<title>Layer 1</title>
'''
for
_
in
range
(
1000
):
svg_content
+=
'<image stroke="null" x="0" y="0" width="359.00006" height="768" xlink:href="data:image/png;;base64,%s" />'
%
dataurl
svg_content
+=
'</g></svg>'
svg_image
.
edit
(
data
=
svg_content
)
self
.
assertEqual
(
'image/svg+xml'
,
svg_image
.
getContentType
())
image_type
,
_
=
svg_image
.
convert
(
'png'
,
display
=
'medium'
)
self
.
assertEqual
(
'image/png'
,
image_type
)
def
test_ConvertImagePdata
(
self
):
image
=
self
.
portal
.
newContent
(
portal_type
=
'Image'
,
id
=
'test_image'
)
image
.
edit
(
file
=
self
.
makeImageFileUpload
(
'erp5_logo.bmp'
))
...
...
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