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
f4e8bbe5
Kaydet (Commit)
f4e8bbe5
authored
Haz 18, 2018
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok: Unit test for jsonToPropertyValuesVector.
Change-Id: I3e0623cc68838c650edbd03cc89bf3fcb8098ff8
üst
1664de4d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
1 deletion
+132
-1
CppunitTest_desktop_lokinit.mk
desktop/CppunitTest_desktop_lokinit.mk
+47
-0
Module_desktop.mk
desktop/Module_desktop.mk
+1
-0
init.hxx
desktop/inc/lib/init.hxx
+6
-0
desktop-lok-init.cxx
desktop/qa/unit/desktop-lok-init.cxx
+77
-0
init.cxx
desktop/source/lib/init.cxx
+1
-1
No files found.
desktop/CppunitTest_desktop_lokinit.mk
0 → 100644
Dosyayı görüntüle @
f4e8bbe5
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,desktop_lok_init))
$(eval $(call gb_CppunitTest_add_exception_objects,desktop_lok_init, \
desktop/qa/unit/desktop-lok-init \
))
$(eval $(call gb_CppunitTest_use_external,desktop_lok_init,boost_headers))
$(eval $(call gb_CppunitTest_use_sdk_api,desktop_lok_init))
$(eval $(call gb_CppunitTest_set_include,desktop_lok_init,\
-I$(SRCDIR)/desktop/source/inc \
-I$(SRCDIR)/desktop/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_libraries,desktop_lok_init, \
comphelper \
cppu \
sal \
sofficeapp \
vcl \
$(gb_UWINAPI) \
))
ifeq ($(OS),LINUX)
$(eval $(call gb_CppunitTest_add_libs,desktop_lok_init,\
-lm \
-ldl \
-lpthread \
))
endif
$(eval $(call gb_CppunitTest_use_configuration,desktop_lok_init))
# vim: set noet sw=4 ts=4:
desktop/Module_desktop.mk
Dosyayı görüntüle @
f4e8bbe5
...
@@ -143,6 +143,7 @@ $(eval $(call gb_Module_add_check_targets,desktop, \
...
@@ -143,6 +143,7 @@ $(eval $(call gb_Module_add_check_targets,desktop, \
ifeq ($(OS),LINUX)
ifeq ($(OS),LINUX)
$(eval $(call gb_Module_add_check_targets,desktop, \
$(eval $(call gb_Module_add_check_targets,desktop, \
CppunitTest_desktop_lib \
CppunitTest_desktop_lib \
CppunitTest_desktop_lokinit \
))
))
endif
endif
...
...
desktop/inc/lib/init.hxx
Dosyayı görüntüle @
f4e8bbe5
...
@@ -16,9 +16,11 @@
...
@@ -16,9 +16,11 @@
#include <mutex>
#include <mutex>
#include <osl/thread.h>
#include <osl/thread.h>
#include <rtl/ref.hxx>
#include <vcl/idle.hxx>
#include <vcl/idle.hxx>
#include <LibreOfficeKit/LibreOfficeKit.h>
#include <LibreOfficeKit/LibreOfficeKit.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XComponent.hpp>
...
@@ -99,6 +101,10 @@ namespace desktop {
...
@@ -99,6 +101,10 @@ namespace desktop {
/// comma, like: Name1=Value1,Name2=Value2,Name3=Value3.
/// comma, like: Name1=Value1,Name2=Value2,Name3=Value3.
/// @param rOptions When exctacted, the Param=Value is removed from it.
/// @param rOptions When exctacted, the Param=Value is removed from it.
DESKTOP_DLLPUBLIC
OUString
extractParameter
(
OUString
&
aOptions
,
const
OUString
&
rName
);
DESKTOP_DLLPUBLIC
OUString
extractParameter
(
OUString
&
aOptions
,
const
OUString
&
rName
);
/// Helper function to convert JSON to a vector of PropertyValues.
/// Public to be unit-test-able.
DESKTOP_DLLPUBLIC
std
::
vector
<
com
::
sun
::
star
::
beans
::
PropertyValue
>
jsonToPropertyValuesVector
(
const
char
*
pJSON
);
}
}
#endif
#endif
...
...
desktop/qa/unit/desktop-lok-init.cxx
0 → 100644
Dosyayı görüntüle @
f4e8bbe5
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <memory>
#include <boost/property_tree/json_parser.hpp>
#include <cppunit/TestFixture.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <cppunit/extensions/HelperMacros.h>
#include <comphelper/anytostring.hxx>
#include <comphelper/sequence.hxx>
#include <cstdlib>
#include <string>
#include <stdio.h>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
#include <vcl/scheduler.hxx>
#include <lib/init.hxx>
using
namespace
css
;
/// Unit tests for desktop/source/lib/init.cxx internals.
class
LOKInitTest
:
public
::
CppUnit
::
TestFixture
{
public
:
LOKInitTest
()
{
}
void
testJsonToPropertyValues
();
CPPUNIT_TEST_SUITE
(
LOKInitTest
);
CPPUNIT_TEST
(
testJsonToPropertyValues
);
CPPUNIT_TEST_SUITE_END
();
};
namespace
{
void
assertSequencesEqual
(
const
uno
::
Sequence
<
beans
::
PropertyValue
>&
expected
,
const
uno
::
Sequence
<
beans
::
PropertyValue
>&
actual
)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"The sequences should have the same length"
,
expected
.
getLength
(),
actual
.
getLength
());
for
(
int
i
=
0
;
i
<
expected
.
getLength
();
++
i
)
{
CPPUNIT_ASSERT_EQUAL
(
expected
[
i
].
Name
,
actual
[
i
].
Name
);
CPPUNIT_ASSERT_EQUAL
(
comphelper
::
anyToString
(
expected
[
i
].
Value
),
comphelper
::
anyToString
(
actual
[
i
].
Value
));
}
}
}
void
LOKInitTest
::
testJsonToPropertyValues
()
{
const
char
arguments
[]
=
"{"
"
\"
FileName
\"
:{"
"
\"
type
\"
:
\"
string
\"
,"
"
\"
value
\"
:
\"
something.odt
\"
"
"}}"
;
uno
::
Sequence
<
beans
::
PropertyValue
>
aArgs
(
1
);
aArgs
[
0
].
Name
=
"FileName"
;
aArgs
[
0
].
Value
<<=
OUString
(
"something.odt"
);
assertSequencesEqual
(
aArgs
,
comphelper
::
containerToSequence
(
desktop
::
jsonToPropertyValuesVector
(
arguments
)));
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
LOKInitTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
desktop/source/lib/init.cxx
Dosyayı görüntüle @
f4e8bbe5
...
@@ -311,7 +311,7 @@ static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
...
@@ -311,7 +311,7 @@ static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
return
aAny
;
return
aAny
;
}
}
st
atic
std
::
vector
<
beans
::
PropertyValue
>
jsonToPropertyValuesVector
(
const
char
*
pJSON
)
st
d
::
vector
<
beans
::
PropertyValue
>
desktop
::
jsonToPropertyValuesVector
(
const
char
*
pJSON
)
{
{
std
::
vector
<
beans
::
PropertyValue
>
aArguments
;
std
::
vector
<
beans
::
PropertyValue
>
aArguments
;
if
(
pJSON
&&
pJSON
[
0
]
!=
'\0'
)
if
(
pJSON
&&
pJSON
[
0
]
!=
'\0'
)
...
...
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