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
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
Klaus Wölfel
erp5
Commits
c80f4e47
Commit
c80f4e47
authored
Feb 21, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: make testFormPrintoutAsODG and testFormPrintoutAsODT work on LibreOffice 4.4.
parent
9d6c0b16
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
product/ERP5OOo/tests/testFormPrintoutAsODG.py
product/ERP5OOo/tests/testFormPrintoutAsODG.py
+9
-5
product/ERP5OOo/tests/testFormPrintoutAsODT.py
product/ERP5OOo/tests/testFormPrintoutAsODT.py
+6
-2
No files found.
product/ERP5OOo/tests/testFormPrintoutAsODG.py
View file @
c80f4e47
...
@@ -325,16 +325,18 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -325,16 +325,18 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
self
.
assertTrue
(
content_xml
.
find
(
"Pictures/0.png"
)
>
0
)
content
=
etree
.
XML
(
content_xml
)
image_element_list
=
content
.
xpath
(
'//draw:image'
,
namespaces
=
content
.
nsmap
)
self
.
assertTrue
(
len
(
image_element_list
)
>
0
)
# check the image is in the odg file
# check the image is in the odg file
try
:
try
:
image_data
=
builder
.
extract
(
"Pictures/0.png"
)
image_path
=
image_element_list
[
0
].
get
(
'{http://www.w3.org/1999/xlink}href'
)
image_data
=
builder
.
extract
(
image_path
)
except
KeyError
:
except
KeyError
:
self
.
fail
(
'image
"Pictures/0.png" not found in odg document'
)
self
.
fail
(
'image
%r not found in odg document'
%
image_path
)
self
.
assertEqual
(
image
.
getData
(),
image_data
,
self
.
assertEqual
(
image
.
getData
(),
image_data
,
'%s != %s'
%
(
len
(
image
.
getData
()),
len
(
image_data
)))
'%s != %s'
%
(
len
(
image
.
getData
()),
len
(
image_data
)))
content
=
etree
.
XML
(
content_xml
)
image_frame_xpath
=
'//draw:frame[@draw:name="image_view"]'
image_frame_xpath
=
'//draw:frame[@draw:name="image_view"]'
image_frame_list
=
content
.
xpath
(
image_frame_xpath
,
namespaces
=
content
.
nsmap
)
image_frame_list
=
content
.
xpath
(
image_frame_xpath
,
namespaces
=
content
.
nsmap
)
self
.
assertTrue
(
len
(
image_frame_list
)
>
0
)
self
.
assertTrue
(
len
(
image_frame_list
)
>
0
)
...
@@ -355,7 +357,9 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -355,7 +357,9 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
builder
=
OOoBuilder
(
odf_document
)
builder
=
OOoBuilder
(
odf_document
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
# confirming the image was removed
# confirming the image was removed
self
.
assertFalse
(
content_xml
.
find
(
"Pictures/0.png"
)
>
0
)
content
=
etree
.
XML
(
content_xml
)
image_element_list
=
content
.
xpath
(
'//draw:image'
,
namespaces
=
content
.
nsmap
)
self
.
assertFalse
(
len
(
image_element_list
)
>
0
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
def
test_04_ProxyField
(
self
):
def
test_04_ProxyField
(
self
):
...
...
product/ERP5OOo/tests/testFormPrintoutAsODT.py
View file @
c80f4e47
...
@@ -534,8 +534,12 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
...
@@ -534,8 +534,12 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
content_xml
=
builder
.
extract
(
"content.xml"
)
content_xml
=
builder
.
extract
(
"content.xml"
)
content_tree
=
etree
.
XML
(
content_xml
)
content_tree
=
etree
.
XML
(
content_xml
)
#Check that foo_1 is inside table, with the same style
#Check that foo_1 is inside table, with the same style
xpath_style_name_expression
=
'//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p[@text:style-name="P4"]/text()'
xpath_style_name_expression
=
'//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p[starts-with(@text:style-name, "P")]'
self
.
assertEqual
([
'foo_1'
,
'foo_2'
],
content_tree
.
xpath
(
xpath_style_name_expression
,
namespaces
=
content_tree
.
nsmap
))
element_list
=
content_tree
.
xpath
(
xpath_style_name_expression
,
namespaces
=
content_tree
.
nsmap
)
self
.
assertEqual
(
len
(
element_list
),
2
)
self
.
assertEqual
(
element_list
[
0
].
get
(
'{%s}style-name'
%
content_tree
.
nsmap
[
'text'
]),
element_list
[
1
].
get
(
'{%s}style-name'
%
content_tree
.
nsmap
[
'text'
]))
self
.
assertEqual
([
'foo_1'
,
'foo_2'
],
[
x
.
text
for
x
in
element_list
])
#Check that each listbox values are inside ODT table cells
#Check that each listbox values are inside ODT table cells
xpath_result_expression
=
'//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p/text()'
xpath_result_expression
=
'//table:table[@table:name="listbox2"]/table:table-row/table:table-cell/text:p/text()'
self
.
assertEqual
([
'foo_1'
,
'foo_title_5'
,
'0.0'
,
'foo_2'
,
'foo_2'
,
'0.0'
,
'1234.5'
],
content_tree
.
xpath
(
xpath_result_expression
,
namespaces
=
content_tree
.
nsmap
))
self
.
assertEqual
([
'foo_1'
,
'foo_title_5'
,
'0.0'
,
'foo_2'
,
'foo_2'
,
'0.0'
,
'1234.5'
],
content_tree
.
xpath
(
xpath_result_expression
,
namespaces
=
content_tree
.
nsmap
))
...
...
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