Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
01b0d6da
Kaydet (Commit)
01b0d6da
authored
Eyl 07, 2017
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
unotest.py: refactor confusing mess of openDoc functions
Change-Id: I148332c639510c55dea2d09bc7aa695708fbf34c
üst
01cc6e51
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
52 deletions
+25
-52
fdo84315.py
dbaccess/qa/python/fdo84315.py
+1
-1
check_cross_references.py
sw/qa/python/check_cross_references.py
+1
-1
check_fields.py
sw/qa/python/check_fields.py
+1
-1
check_flies.py
sw/qa/python/check_flies.py
+1
-1
text_portion_enumeration_test.py
sw/qa/python/text_portion_enumeration_test.py
+3
-3
unotest.py
unotest/source/python/org/libreoffice/unotest.py
+18
-45
No files found.
dbaccess/qa/python/fdo84315.py
Dosyayı görüntüle @
01b0d6da
...
@@ -20,7 +20,7 @@ class Fdo84315(unittest.TestCase):
...
@@ -20,7 +20,7 @@ class Fdo84315(unittest.TestCase):
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
.
setUp
()
cls
.
_uno
.
setUp
()
workdir
=
os
.
environ
[
"WORKDIR_FOR_BUILD"
]
workdir
=
os
.
environ
[
"WORKDIR_FOR_BUILD"
]
cls
.
_xDoc
=
cls
.
_uno
.
openDoc
(
workdir
+
"/CppunitTest/fdo84315.odb"
)
cls
.
_xDoc
=
cls
.
_uno
.
openDoc
FromAbsolutePath
(
workdir
+
"/CppunitTest/fdo84315.odb"
)
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
...
...
sw/qa/python/check_cross_references.py
Dosyayı görüntüle @
01b0d6da
...
@@ -38,7 +38,7 @@ class CheckCrossReferences(unittest.TestCase):
...
@@ -38,7 +38,7 @@ class CheckCrossReferences(unittest.TestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
.
setUp
()
cls
.
_uno
.
setUp
()
cls
.
document
=
cls
.
_uno
.
open
WriterTemplateDoc
(
"CheckCrossReferences.odt"
)
cls
.
document
=
cls
.
_uno
.
open
DocFromTDOC
(
"CheckCrossReferences.odt"
)
cls
.
xParaEnum
=
None
cls
.
xParaEnum
=
None
cls
.
xPortionEnum
=
None
cls
.
xPortionEnum
=
None
cls
.
xFieldsRefresh
=
None
cls
.
xFieldsRefresh
=
None
...
...
sw/qa/python/check_fields.py
Dosyayı görüntüle @
01b0d6da
...
@@ -17,7 +17,7 @@ class CheckFields(unittest.TestCase):
...
@@ -17,7 +17,7 @@ class CheckFields(unittest.TestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
.
setUp
()
cls
.
_uno
.
setUp
()
cls
.
_xDoc
=
cls
.
_uno
.
open
WriterTemplateDoc
(
"fdo39694.ott"
)
cls
.
_xDoc
=
cls
.
_uno
.
open
TemplateFromTDOC
(
"fdo39694.ott"
)
cls
.
_xEmptyDoc
=
cls
.
_uno
.
openEmptyWriterDoc
()
cls
.
_xEmptyDoc
=
cls
.
_uno
.
openEmptyWriterDoc
()
@classmethod
@classmethod
...
...
sw/qa/python/check_flies.py
Dosyayı görüntüle @
01b0d6da
...
@@ -26,7 +26,7 @@ class CheckFlies(unittest.TestCase):
...
@@ -26,7 +26,7 @@ class CheckFlies(unittest.TestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
=
UnoInProcess
()
cls
.
_uno
.
setUp
()
cls
.
_uno
.
setUp
()
cls
.
document
=
cls
.
_uno
.
open
WriterTemplateDoc
(
"CheckFlies.odt"
)
cls
.
document
=
cls
.
_uno
.
open
DocFromTDOC
(
"CheckFlies.odt"
)
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
...
...
sw/qa/python/text_portion_enumeration_test.py
Dosyayı görüntüle @
01b0d6da
...
@@ -3250,7 +3250,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
...
@@ -3250,7 +3250,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
def
doload
(
self
,
file
):
def
doload
(
self
,
file
):
xComp
=
None
xComp
=
None
print
(
"Loading test document..."
)
print
(
"Loading test document..."
)
xComp
=
self
.
__class__
.
_uno
.
openDoc
(
file
)
xComp
=
self
.
__class__
.
_uno
.
openDoc
FromAbsolutePath
(
file
)
self
.
assertIsNotNone
(
xComp
,
"cannot load: {}"
.
format
(
file
))
self
.
assertIsNotNone
(
xComp
,
"cannot load: {}"
.
format
(
file
))
print
(
"...done"
)
print
(
"...done"
)
return
xComp
return
xComp
...
@@ -3266,7 +3266,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
...
@@ -3266,7 +3266,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
xComp
=
None
xComp
=
None
filename
=
"TESTMETA.odt"
filename
=
"TESTMETA.odt"
try
:
try
:
xComp
=
self
.
__class__
.
_uno
.
open
BaseDoc
(
filename
)
xComp
=
self
.
__class__
.
_uno
.
open
DocFromTDOC
(
filename
)
if
xComp
:
if
xComp
:
self
.
checkloadmeta
(
xComp
)
self
.
checkloadmeta
(
xComp
)
with
TemporaryDirectory
()
as
tempdir
:
with
TemporaryDirectory
()
as
tempdir
:
...
@@ -3338,7 +3338,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
...
@@ -3338,7 +3338,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
xComp
=
None
xComp
=
None
filename
=
"TESTXMLID.odt"
filename
=
"TESTXMLID.odt"
try
:
try
:
xComp
=
self
.
__class__
.
_uno
.
open
BaseDoc
(
filename
)
xComp
=
self
.
__class__
.
_uno
.
open
DocFromTDOC
(
filename
)
if
xComp
:
if
xComp
:
self
.
checkloadxmlid
(
xComp
)
self
.
checkloadxmlid
(
xComp
)
with
TemporaryDirectory
()
as
tempdir
:
with
TemporaryDirectory
()
as
tempdir
:
...
...
unotest/source/python/org/libreoffice/unotest.py
Dosyayı görüntüle @
01b0d6da
...
@@ -195,72 +195,45 @@ class UnoInProcess:
...
@@ -195,72 +195,45 @@ class UnoInProcess:
if
not
(
havePonies
):
if
not
(
havePonies
):
pyuno
.
private_initTestEnvironment
()
pyuno
.
private_initTestEnvironment
()
havePonies
=
True
havePonies
=
True
def
openEmptyWriterDoc
(
self
):
def
openEmptyWriterDoc
(
self
):
assert
(
self
.
xContext
)
return
self
.
openEmptyDoc
(
"private:factory/swriter"
)
smgr
=
self
.
getContext
()
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
props
=
[(
"Hidden"
,
True
),
(
"ReadOnly"
,
False
)]
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
"private:factory/swriter"
,
"_blank"
,
0
,
loadProps
)
assert
(
self
.
xDoc
)
return
self
.
xDoc
def
openEmptyCalcDoc
(
self
):
def
openEmptyCalcDoc
(
self
):
self
.
xDoc
=
self
.
openEmptyDoc
(
"private:factory/scalc"
)
return
self
.
openEmptyDoc
(
"private:factory/scalc"
)
return
self
.
xDoc
def
openEmptyDoc
(
self
,
url
,
bHidden
=
True
,
bReadOnly
=
False
):
def
openEmptyDoc
(
self
,
url
,
bHidden
=
True
,
bReadOnly
=
False
):
assert
(
self
.
xContext
)
smgr
=
self
.
getContext
()
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
props
=
[(
"Hidden"
,
bHidden
),
(
"ReadOnly"
,
bReadOnly
)]
props
=
[(
"Hidden"
,
bHidden
),
(
"ReadOnly"
,
bReadOnly
)]
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
return
self
.
__openDocFromURL
(
url
,
props
)
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
)
assert
(
self
.
xDoc
)
return
self
.
xDoc
def
openWriterTemplateDoc
(
self
,
file
):
def
openTemplateFromTDOC
(
self
,
file
):
assert
(
self
.
xContext
)
return
self
.
openDocFromTDOC
(
file
,
True
)
smgr
=
self
.
getContext
()
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
def
openDocFromTDOC
(
self
,
file
,
asTemplate
=
False
):
props
=
[(
"Hidden"
,
True
),
(
"ReadOnly"
,
False
),
(
"AsTemplate"
,
True
)]
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
path
=
os
.
getenv
(
"TDOC"
)
path
=
os
.
getenv
(
"TDOC"
)
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
# do not quote drive letter - it must be "X:"
# do not quote drive letter - it must be "X:"
url
=
"file:///"
+
path
+
"/"
+
quote
(
file
)
url
=
"file:///"
+
path
+
"/"
+
quote
(
file
)
else
:
else
:
url
=
"file://"
+
quote
(
path
)
+
"/"
+
quote
(
file
)
url
=
"file://"
+
quote
(
path
)
+
"/"
+
quote
(
file
)
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
)
return
self
.
openDocFromURL
(
url
,
asTemplate
)
assert
(
self
.
xDoc
)
return
self
.
xDoc
def
openBaseDoc
(
self
,
file
):
def
openDocFromAbsolutePath
(
self
,
file
):
assert
(
self
.
xContext
)
smgr
=
self
.
getContext
()
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
props
=
[(
"Hidden"
,
True
),
(
"ReadOnly"
,
False
),
(
"AsTemplate"
,
False
)]
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
path
=
os
.
getenv
(
"TDOC"
)
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
#do not quote drive letter - it must be "X:"
url
=
"file:///"
+
file
url
=
"file:///"
+
path
+
"/"
+
quote
(
file
)
else
:
else
:
url
=
"file://"
+
quote
(
path
)
+
"/"
+
quote
(
file
)
url
=
"file://"
+
file
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
)
return
self
.
openDocFromURL
(
url
)
assert
(
self
.
xDoc
)
return
self
.
xDoc
def
openDoc
(
self
,
file
):
def
openDocFromURL
(
self
,
url
,
asTemplate
=
False
):
props
=
[(
"Hidden"
,
True
),
(
"ReadOnly"
,
False
),
(
"AsTemplate"
,
asTemplate
)]
return
self
.
__openDocFromURL
(
url
,
props
)
def
__openDocFromURL
(
self
,
url
,
props
):
assert
(
self
.
xContext
)
assert
(
self
.
xContext
)
smgr
=
self
.
getContext
()
.
ServiceManager
smgr
=
self
.
getContext
()
.
ServiceManager
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
desktop
=
smgr
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
self
.
getContext
())
props
=
[(
"Hidden"
,
True
),
(
"ReadOnly"
,
False
),
(
"AsTemplate"
,
False
)]
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
loadProps
=
tuple
([
mkPropertyValue
(
name
,
value
)
for
(
name
,
value
)
in
props
])
if
os
.
name
==
"nt"
:
url
=
"file:///"
+
file
else
:
url
=
"file://"
+
file
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
)
self
.
xDoc
=
desktop
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
)
assert
(
self
.
xDoc
)
assert
(
self
.
xDoc
)
return
self
.
xDoc
return
self
.
xDoc
...
...
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