Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
c467bd28
Commit
c467bd28
authored
Dec 13, 2017
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_corporate_identity: convert bmp data to compressed base64 png to view more easily
parent
f096830e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
bt5/erp5_corporate_identity/PathTemplateItem/web_page_module/template_test_slideshow_output_expected_003_en_html.html
.../template_test_slideshow_output_expected_003_en_html.html
+1
-1
bt5/erp5_corporate_identity/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplates.py
...al_components/test.erp5.testCorporateIdentityTemplates.py
+11
-3
No files found.
bt5/erp5_corporate_identity/PathTemplateItem/web_page_module/template_test_slideshow_output_expected_003_en_html.html
View file @
c467bd28
...
...
@@ -43,7 +43,7 @@
<div
class=
"ci-slideshow-container-right"
>
©
<span>
2017
</span>
<span></span><br
/>
<span>
Test Organisation
</span><br
/>
<span>
Test Author, Test Recipient
</span>
<span
class=
"page"
></span>
|
<span
class=
"topage"
></span>
</div>
...
...
bt5/erp5_corporate_identity/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplates.py
View file @
c467bd28
...
...
@@ -34,6 +34,8 @@ import functools
import
cStringIO
import
math
import
re
import
io
import
base64
host_url
=
r"https?://localhost(?::[0-9]+)?/[^/]+/"
test_url
=
"https://softinst73908.host.vifib.net/erp5/"
...
...
@@ -150,14 +152,21 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
def
isImageRenderingEqual
(
self
,
image_data_1
,
image_data_2
,
max_rms
=
10.0
):
return
self
.
computeImageRenderingRootMeanSquare
(
image_data_1
,
image_data_2
)
<=
max_rms
def
convertToPng
(
self
,
img_data
):
bmp_file
=
Image
.
open
(
io
.
BytesIO
(
img_data
))
img_buff
=
cStringIO
.
StringIO
()
bmp_file
.
save
(
img_buff
,
format
=
'PNG'
,
optimize
=
True
,
quality
=
75
)
img_data
=
img_buff
.
getvalue
()
return
''
.
join
([
'data:image/png;base64,'
,
base64
.
encodestring
(
img_data
)])
def
assertImageRenderingEquals
(
self
,
test_image_data
,
expected_image_data
,
message
=
"Images rendering differs"
,
max_rms
=
10.0
):
rms
=
self
.
computeImageRenderingRootMeanSquare
(
test_image_data
,
expected_image_data
)
if
rms
<=
max_rms
:
return
raise
AssertionError
(
"%(message)s
\
n
Comparing image:
\
n
%(base64_1)s
\
n
With image:
\
n
%(base64_2)s
\
n
RMS: %(rms)s > %(max_rms)s
\
n
AssertionError: %(message)s"
%
{
"message"
:
message
,
"base64_1"
:
"pfff"
,
#base64.encodestri
ng(test_image_data),
"base64_2"
:
"pfff"
,
#base64.encodestri
ng(expected_image_data),
"base64_1"
:
self
.
convertToP
ng
(
test_image_data
),
"base64_2"
:
self
.
convertToP
ng
(
expected_image_data
),
"rms"
:
rms
,
"max_rms"
:
max_rms
,
})
...
...
@@ -1121,5 +1130,4 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
override_revision
=
1
)
)
\ No newline at end of file
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