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
ed68fb3c
Kaydet (Commit)
ed68fb3c
authored
Kas 03, 2015
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok: Unit test for LOK_CALLBACK_UNO_COMMAND_RESULT.
Change-Id: I917d47478504dc6fafd3fc675fe8458690c7cc2a
üst
007acbad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
test_desktop_lib.cxx
desktop/qa/desktop_lib/test_desktop_lib.cxx
+36
-0
No files found.
desktop/qa/desktop_lib/test_desktop_lib.cxx
Dosyayı görüntüle @
ed68fb3c
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <comphelper/lok.hxx>
#include <comphelper/lok.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <comphelper/dispatchcommand.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/propertysequence.hxx>
#include <osl/conditn.hxx>
#include <svl/srchitem.hxx>
#include <svl/srchitem.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <unotools/tempfile.hxx>
#include <unotools/tempfile.hxx>
...
@@ -73,6 +74,7 @@ public:
...
@@ -73,6 +74,7 @@ public:
void
testSaveAsCalc
();
void
testSaveAsCalc
();
void
testPasteWriter
();
void
testPasteWriter
();
void
testRowColumnHeaders
();
void
testRowColumnHeaders
();
void
testCommandResult
();
CPPUNIT_TEST_SUITE
(
DesktopLOKTest
);
CPPUNIT_TEST_SUITE
(
DesktopLOKTest
);
CPPUNIT_TEST
(
testGetStyles
);
CPPUNIT_TEST
(
testGetStyles
);
...
@@ -86,12 +88,17 @@ public:
...
@@ -86,12 +88,17 @@ public:
CPPUNIT_TEST
(
testSaveAsCalc
);
CPPUNIT_TEST
(
testSaveAsCalc
);
CPPUNIT_TEST
(
testPasteWriter
);
CPPUNIT_TEST
(
testPasteWriter
);
CPPUNIT_TEST
(
testRowColumnHeaders
);
CPPUNIT_TEST
(
testRowColumnHeaders
);
CPPUNIT_TEST
(
testCommandResult
);
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
OString
m_aTextSelection
;
OString
m_aTextSelection
;
std
::
vector
<
OString
>
m_aSearchResultSelection
;
std
::
vector
<
OString
>
m_aSearchResultSelection
;
std
::
vector
<
int
>
m_aSearchResultPart
;
std
::
vector
<
int
>
m_aSearchResultPart
;
// for testCommandResult
osl
::
Condition
m_aCommandResultCondition
;
OString
m_aCommandResult
;
};
};
LibLODocument_Impl
*
DesktopLOKTest
::
loadDoc
(
const
char
*
pName
,
LibreOfficeKitDocumentType
eType
)
LibLODocument_Impl
*
DesktopLOKTest
::
loadDoc
(
const
char
*
pName
,
LibreOfficeKitDocumentType
eType
)
...
@@ -155,6 +162,12 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload)
...
@@ -155,6 +162,12 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload)
}
}
}
}
break
;
break
;
case
LOK_CALLBACK_UNO_COMMAND_RESULT
:
{
m_aCommandResult
=
pPayload
;
m_aCommandResultCondition
.
set
();
}
break
;
}
}
}
}
...
@@ -384,6 +397,29 @@ void DesktopLOKTest::testRowColumnHeaders()
...
@@ -384,6 +397,29 @@ void DesktopLOKTest::testRowColumnHeaders()
}
}
}
}
void
DesktopLOKTest
::
testCommandResult
()
{
LibLODocument_Impl
*
pDocument
=
loadDoc
(
"blank_text.odt"
);
pDocument
->
pClass
->
registerCallback
(
pDocument
,
&
DesktopLOKTest
::
callback
,
this
);
// the postUnoCommand() is supposed to be async, let's test it safely
// [no idea if it is async in reality - most probably we are operating
// under some solar mutex or something anyway ;-) - but...]
m_aCommandResultCondition
.
reset
();
pDocument
->
pClass
->
postUnoCommand
(
pDocument
,
".uno:Bold"
,
0
,
true
);
TimeValue
aTimeValue
=
{
2
,
0
};
// 2 seconds max
m_aCommandResultCondition
.
wait
(
aTimeValue
);
boost
::
property_tree
::
ptree
aTree
;
std
::
stringstream
aStream
(
m_aCommandResult
.
getStr
());
boost
::
property_tree
::
read_json
(
aStream
,
aTree
);
CPPUNIT_ASSERT_EQUAL
(
aTree
.
get_child
(
"commandName"
).
get_value
<
std
::
string
>
(),
std
::
string
(
".uno:Bold"
));
CPPUNIT_ASSERT_EQUAL
(
aTree
.
get_child
(
"success"
).
get_value
<
bool
>
(),
true
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
DesktopLOKTest
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
DesktopLOKTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
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