Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Kirill Smelkov
cloudooo
Commits
fc7346d0
Commit
fc7346d0
authored
Feb 04, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests and mimemapper.py for LibreOffice 4.2.
parent
056a2158
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
143 deletions
+51
-143
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+4
-0
cloudooo/handler/ooo/tests/testOooMimemapper.py
cloudooo/handler/ooo/tests/testOooMimemapper.py
+22
-50
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+25
-93
No files found.
cloudooo/handler/ooo/mimemapper.py
View file @
fc7346d0
...
@@ -99,11 +99,15 @@ class MimeMapper(object):
...
@@ -99,11 +99,15 @@ class MimeMapper(object):
"""
"""
alternative_extension_dict
=
{
alternative_extension_dict
=
{
'Microsoft Excel 2007/2010 XML'
:
'ms.xlsx'
,
'Microsoft Excel 2007/2010 XML'
:
'ms.xlsx'
,
'Microsoft Excel 2007/2010/2013 XML'
:
'ms.xlsx'
,
'Microsoft Excel 5.0'
:
'5.xls'
,
'Microsoft Excel 5.0'
:
'5.xls'
,
'Microsoft Excel 95'
:
'95.xls'
,
'Microsoft Excel 95'
:
'95.xls'
,
'Microsoft PowerPoint 2007/2010 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010 XML'
:
'ms.pptx'
,
'Microsoft PowerPoint 2007/2010 XML'
:
'ms.pptx'
,
'Microsoft PowerPoint 2007/2010/2013 XML'
:
'ms.pptx'
,
'Microsoft Word 2007/2010 XML'
:
'ms.docx'
,
'Microsoft Word 2007/2010 XML'
:
'ms.docx'
,
'Microsoft Word 2007/2010/2013 XML'
:
'ms.docx'
,
'Microsoft Word 6.0'
:
'6.doc'
,
'Microsoft Word 6.0'
:
'6.doc'
,
'Microsoft Word 95'
:
'95.doc'
,
'Microsoft Word 95'
:
'95.doc'
,
}
}
...
...
cloudooo/handler/ooo/tests/testOooMimemapper.py
View file @
fc7346d0
...
@@ -31,26 +31,17 @@ from cloudooo.handler.ooo.application.openoffice import openoffice
...
@@ -31,26 +31,17 @@ from cloudooo.handler.ooo.application.openoffice import openoffice
from
cloudooo.handler.ooo.mimemapper
import
MimeMapper
from
cloudooo.handler.ooo.mimemapper
import
MimeMapper
text_expected_tuple
=
(
text_expected_tuple
=
(
(
'doc'
,
'Microsoft Word 6.0'
),
(
'doc'
,
'Microsoft Word 95'
),
(
'doc'
,
'Microsoft Word 97/2000/XP/2003'
),
(
'doc'
,
'Microsoft Word 97/2000/XP/2003'
),
(
'docx'
,
'Microsoft Word 2007 XML'
),
(
'docx'
,
'Microsoft Word 2007
/2010/2013
XML'
),
(
'docx'
,
'Office Open XML Text'
),
(
'docx'
,
'Office Open XML Text'
),
(
'docx'
,
'Microsoft Word 2007/2010 XML'
),
(
'html'
,
'HTML Document (Writer)'
),
(
'html'
,
'HTML Document (OpenOffice.org Writer)'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'html'
,
'XHTML'
),
(
'odt'
,
'ODF Text Document'
),
(
'odt'
,
'ODF Text Document'
),
(
'ott'
,
'ODF Text Document Template'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'rtf'
,
'Rich Text Format'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'sdw'
,
'StarWriter 3.0'
),
(
'rtf'
,
'Rich Text'
),
(
'sdw'
,
'StarWriter 4.0'
),
(
'sdw'
,
'StarWriter 5.0'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document'
),
(
'txt'
,
'Text Encoded'
),
(
'txt'
,
'Text Encoded'
),
(
'txt'
,
'Text'
),
(
'pdb'
,
'AportisDoc (Palm)'
),
(
'psw'
,
'Pocket Word'
),
)
)
global_expected_tuple
=
(
global_expected_tuple
=
(
...
@@ -61,12 +52,10 @@ drawing_expected_tuple = (
...
@@ -61,12 +52,10 @@ drawing_expected_tuple = (
(
'emf'
,
'EMF - Enhanced Metafile'
),
(
'emf'
,
'EMF - Enhanced Metafile'
),
(
'eps'
,
'EPS - Encapsulated PostScript'
),
(
'eps'
,
'EPS - Encapsulated PostScript'
),
(
'gif'
,
'GIF - Graphics Interchange Format'
),
(
'gif'
,
'GIF - Graphics Interchange Format'
),
(
'html'
,
'HTML Document (OpenOffice.org Draw)'
),
(
'html'
,
'HTML Document (Draw)'
),
(
'html'
,
'XHTML'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'met'
,
'MET - OS/2 Metafile'
),
(
'met'
,
'MET - OS/2 Metafile'
),
(
'odg'
,
'ODF Drawing'
),
(
'odg'
,
'ODF Drawing'
),
(
'otg'
,
'ODF Drawing Template'
),
(
'pbm'
,
'PBM - Portable Bitmap'
),
(
'pbm'
,
'PBM - Portable Bitmap'
),
(
'pct'
,
'PCT - Mac Pict'
),
(
'pct'
,
'PCT - Mac Pict'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
...
@@ -74,8 +63,6 @@ drawing_expected_tuple = (
...
@@ -74,8 +63,6 @@ drawing_expected_tuple = (
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'sda'
,
'StarDraw 5.0'
),
(
'sdd'
,
'StarDraw 3.0'
),
(
'svg'
,
'SVG - Scalable Vector Graphics'
),
(
'svg'
,
'SVG - Scalable Vector Graphics'
),
(
'svm'
,
'SVM - StarView Metafile'
),
(
'svm'
,
'SVM - StarView Metafile'
),
(
'sxd'
,
'OpenOffice.org 1.0 Drawing'
),
(
'sxd'
,
'OpenOffice.org 1.0 Drawing'
),
...
@@ -86,11 +73,11 @@ drawing_expected_tuple = (
...
@@ -86,11 +73,11 @@ drawing_expected_tuple = (
web_expected_tuple
=
(
web_expected_tuple
=
(
(
'html'
,
'HTML Document'
),
(
'html'
,
'HTML Document'
),
(
'odt'
,
'
OpenOffice.org Text (OpenOffice.org
Writer/Web)'
),
(
'odt'
,
'
Text (
Writer/Web)'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document (
OpenOffice.org
Writer/Web)'
),
(
'sxw'
,
'OpenOffice.org 1.0 Text Document (Writer/Web)'
),
(
'txt'
,
'Text (
OpenOffice.org
Writer/Web)'
),
(
'txt'
,
'Text (Writer/Web)'
),
(
'txt'
,
'Text Encoded (
OpenOffice.org
Writer/Web)'
),
(
'txt'
,
'Text Encoded (Writer/Web)'
),
)
)
presentation_expected_tuple
=
(
presentation_expected_tuple
=
(
...
@@ -98,30 +85,27 @@ presentation_expected_tuple = (
...
@@ -98,30 +85,27 @@ presentation_expected_tuple = (
(
'emf'
,
'EMF - Enhanced Metafile'
),
(
'emf'
,
'EMF - Enhanced Metafile'
),
(
'eps'
,
'EPS - Encapsulated PostScript'
),
(
'eps'
,
'EPS - Encapsulated PostScript'
),
(
'gif'
,
'GIF - Graphics Interchange Format'
),
(
'gif'
,
'GIF - Graphics Interchange Format'
),
(
'html'
,
'HTML Document (OpenOffice.org Impress)'
),
(
'html'
,
'HTML Document (Impress)'
),
(
'html'
,
'XHTML'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'jpg'
,
'JPEG - Joint Photographic Experts Group'
),
(
'met'
,
'MET - OS/2 Metafile'
),
(
'met'
,
'MET - OS/2 Metafile'
),
(
'odg'
,
'ODF Drawing (Impress)'
),
(
'odg'
,
'ODF Drawing (Impress)'
),
(
'odp'
,
'ODF Presentation'
),
(
'odp'
,
'ODF Presentation'
),
(
'otp'
,
'ODF Presentation Template'
),
(
'pbm'
,
'PBM - Portable Bitmap'
),
(
'pbm'
,
'PBM - Portable Bitmap'
),
(
'pct'
,
'PCT - Mac Pict'
),
(
'pct'
,
'PCT - Mac Pict'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pgm'
,
'PGM - Portable Graymap'
),
(
'pgm'
,
'PGM - Portable Graymap'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'png'
,
'PNG - Portable Network Graphic'
),
(
'pot'
,
'Microsoft PowerPoint 97/2000/XP/2003 Template'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'ppm'
,
'PPM - Portable Pixelmap'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'
),
(
'pps'
,
'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'
),
(
'ppsx'
,
'Microsoft PowerPoint 2007/2010/2013 XML AutoPlay'
),
(
'ppsx'
,
'Office Open XML Presentation AutoPlay'
),
(
'ppt'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'ppt'
,
'Microsoft PowerPoint 97/2000/XP/2003'
),
(
'pptx'
,
'Microsoft PowerPoint 2007/2010/2013 XML'
),
(
'pptx'
,
'Office Open XML Presentation'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'ras'
,
'RAS - Sun Raster Image'
),
(
'sda'
,
'StarDraw 5.0 (OpenOffice.org Impress)'
),
(
'sdd'
,
'StarDraw 3.0 (OpenOffice.org Impress)'
),
(
'sdd'
,
'StarImpress 4.0'
),
(
'sdd'
,
'StarImpress 5.0'
),
(
'svg'
,
'SVG - Scalable Vector Graphics'
),
(
'svg'
,
'SVG - Scalable Vector Graphics'
),
(
'svm'
,
'SVM - StarView Metafile'
),
(
'svm'
,
'SVM - StarView Metafile'
),
(
'sxd'
,
'OpenOffice.org 1.0 Drawing (
OpenOffice.org
Impress)'
),
(
'sxd'
,
'OpenOffice.org 1.0 Drawing (Impress)'
),
(
'sxi'
,
'OpenOffice.org 1.0 Presentation'
),
(
'sxi'
,
'OpenOffice.org 1.0 Presentation'
),
(
'tif'
,
'TIFF - Tagged Image File Format'
),
(
'tif'
,
'TIFF - Tagged Image File Format'
),
(
'wmf'
,
'WMF - Windows Metafile'
),
(
'wmf'
,
'WMF - Windows Metafile'
),
...
@@ -130,23 +114,13 @@ presentation_expected_tuple = (
...
@@ -130,23 +114,13 @@ presentation_expected_tuple = (
spreadsheet_expected_list
=
(
spreadsheet_expected_list
=
(
(
'csv'
,
'Text CSV'
),
(
'csv'
,
'Text CSV'
),
(
'html'
,
'HTML Document (OpenOffice.org Calc)'
),
(
'html'
,
'HTML Document (Calc)'
),
(
'html'
,
'XHTML'
),
(
'ods'
,
'ODF Spreadsheet'
),
(
'ods'
,
'ODF Spreadsheet'
),
(
'ots'
,
'ODF Spreadsheet Template'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'pdf'
,
'PDF - Portable Document Format'
),
(
'sdc'
,
'StarCalc 3.0'
),
(
'sdc'
,
'StarCalc 4.0'
),
(
'sdc'
,
'StarCalc 5.0'
),
(
'slk'
,
'SYLK'
),
(
'slk'
,
'SYLK'
),
(
'sxc'
,
'OpenOffice.org 1.0 Spreadsheet'
),
(
'sxc'
,
'OpenOffice.org 1.0 Spreadsheet'
),
(
'xls'
,
'Microsoft Excel 5.0'
),
(
'xls'
,
'Microsoft Excel 95'
),
(
'xls'
,
'Microsoft Excel 97/2000/XP/2003'
),
(
'xls'
,
'Microsoft Excel 97/2000/XP/2003'
),
(
'xlt'
,
'Microsoft Excel 5.0 Template'
),
(
'xlsx'
,
'Microsoft Excel 2007/2010/2013 XML'
),
(
'xlt'
,
'Microsoft Excel 95 Template'
),
(
'xlt'
,
'Microsoft Excel 97/2000/XP/2003 Template'
),
(
'xlsx'
,
'Microsoft Excel 2007/2010 XML'
),
(
'xlsx'
,
'Office Open XML Spreadsheet'
),
(
'xlsx'
,
'Office Open XML Spreadsheet'
),
)
)
...
@@ -161,6 +135,7 @@ math_expected_tuple = (
...
@@ -161,6 +135,7 @@ math_expected_tuple = (
)
)
chart_expected_tuple
=
(
chart_expected_tuple
=
(
(
'odc'
,
'ODF Chart'
),
)
)
OPENOFFICE
=
True
OPENOFFICE
=
True
...
@@ -207,9 +182,9 @@ class TestMimeMapper(HandlerTestCase):
...
@@ -207,9 +182,9 @@ class TestMimeMapper(HandlerTestCase):
pdf_filter_list
=
self
.
mimemapper
.
getFilterList
(
'pdf'
)
pdf_filter_list
=
self
.
mimemapper
.
getFilterList
(
'pdf'
)
self
.
assertEquals
(
len
(
pdf_filter_list
),
5
)
self
.
assertEquals
(
len
(
pdf_filter_list
),
5
)
xls_filter_list
=
self
.
mimemapper
.
getFilterList
(
'xls'
)
xls_filter_list
=
self
.
mimemapper
.
getFilterList
(
'xls'
)
self
.
assertEquals
(
len
(
xls_filter_list
),
3
)
self
.
assertEquals
(
len
(
xls_filter_list
),
1
)
doc_filter_list
=
self
.
mimemapper
.
getFilterList
(
'doc'
)
doc_filter_list
=
self
.
mimemapper
.
getFilterList
(
'doc'
)
self
.
assertEquals
(
len
(
doc_filter_list
),
3
)
self
.
assertEquals
(
len
(
doc_filter_list
),
1
)
def
testGetDocumentTypeDict
(
self
):
def
testGetDocumentTypeDict
(
self
):
"""Test if dictonary document type returns type correctly."""
"""Test if dictonary document type returns type correctly."""
...
@@ -217,10 +192,7 @@ class TestMimeMapper(HandlerTestCase):
...
@@ -217,10 +192,7 @@ class TestMimeMapper(HandlerTestCase):
type
=
document_type_dict
.
get
(
"text"
)
type
=
document_type_dict
.
get
(
"text"
)
self
.
assertEquals
(
type
,
'com.sun.star.text.TextDocument'
)
self
.
assertEquals
(
type
,
'com.sun.star.text.TextDocument'
)
type
=
document_type_dict
.
get
(
"chart"
)
type
=
document_type_dict
.
get
(
"chart"
)
# For now, chart document filters are maked as NotInFileDialog and
self
.
assertEquals
(
type
,
'com.sun.star.chart2.ChartDocument'
)
# NotInChooser.
# self.assertEquals(type, 'com.sun.star.chart2.ChartDocument')
self
.
assertEquals
(
type
,
None
)
type
=
document_type_dict
.
get
(
"drawing"
)
type
=
document_type_dict
.
get
(
"drawing"
)
self
.
assertEquals
(
type
,
'com.sun.star.drawing.DrawingDocument'
)
self
.
assertEquals
(
type
,
'com.sun.star.drawing.DrawingDocument'
)
type
=
document_type_dict
.
get
(
"presentation"
)
type
=
document_type_dict
.
get
(
"presentation"
)
...
...
cloudooo/handler/ooo/tests/testOooServer.py
View file @
fc7346d0
This diff is collapsed.
Click to expand it.
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