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
ff9614a7
Kaydet (Commit)
ff9614a7
authored
Ara 17, 2013
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add a unit test trying to create every available service with default ctor.
Change-Id: I79e70aeabdb816eaf7a719d2094034d78d11c90b
üst
d8bbae2f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
0 deletions
+132
-0
CppunitTest_services.mk
postprocess/CppunitTest_services.mk
+31
-0
Module_postprocess.mk
postprocess/Module_postprocess.mk
+4
-0
services.cxx
postprocess/qa/services.cxx
+97
-0
No files found.
postprocess/CppunitTest_services.mk
0 → 100644
Dosyayı görüntüle @
ff9614a7
# -*- 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,services))
$(eval $(call gb_CppunitTest_add_exception_objects,services, \
postprocess/qa/services \
))
$(eval $(call gb_CppunitTest_use_libraries,services, \
cppu \
sal \
test \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,services))
$(eval $(call gb_CppunitTest_use_ure,services))
$(eval $(call gb_CppunitTest_use_rdb,services,services))
$(eval $(call gb_CppunitTest_use_configuration,services))
# vim: set noet sw=4 ts=4:
postprocess/Module_postprocess.mk
Dosyayı görüntüle @
ff9614a7
...
...
@@ -28,4 +28,8 @@ $(eval $(call gb_Module_add_targets,postprocess,\
))
endif
$(eval $(call gb_Module_add_check_targets,postprocess,\
CppunitTest_services \
))
# vim: set noet sw=4 ts=4:
postprocess/qa/services.cxx
0 → 100644
Dosyayı görüntüle @
ff9614a7
/* -*- 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 <sal/config.h>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XServiceConstructorDescription.hpp>
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <test/bootstrapfixture.hxx>
using
namespace
css
::
container
;
using
namespace
css
::
reflection
;
using
namespace
css
::
uno
;
namespace
{
class
ServicesTest
:
public
test
::
BootstrapFixture
{
public
:
virtual
void
setUp
();
virtual
void
tearDown
();
void
test
();
CPPUNIT_TEST_SUITE
(
ServicesTest
);
CPPUNIT_TEST
(
test
);
CPPUNIT_TEST_SUITE_END
();
};
void
ServicesTest
::
setUp
()
{
test
::
BootstrapFixture
::
setUp
();
}
void
ServicesTest
::
tearDown
()
{
test
::
BootstrapFixture
::
tearDown
();
}
void
ServicesTest
::
test
()
{
Reference
<
XHierarchicalNameAccess
>
xTypeManager
(
m_xContext
->
getValueByName
(
"/singletons/com.sun.star.reflection.theTypeDescriptionManager"
),
UNO_QUERY_THROW
);
Sequence
<
OUString
>
seq
=
m_xContext
->
getServiceManager
()
->
getAvailableServiceNames
();
OUString
*
s
=
seq
.
getArray
();
for
(
sal_Int32
i
=
0
;
i
<
seq
.
getLength
();
i
++
)
{
if
(
!
xTypeManager
->
hasByHierarchicalName
(
s
[
i
]))
{
continue
;
}
Reference
<
XServiceTypeDescription2
>
xDesc
(
xTypeManager
->
getByHierarchicalName
(
s
[
i
]),
UNO_QUERY
);
if
(
!
xDesc
.
is
())
{
// Does happen for singletons?
continue
;
}
Sequence
<
Reference
<
XServiceConstructorDescription
>
>
xseq
=
xDesc
->
getConstructors
();
bool
bHasDefault
=
false
;
for
(
sal_Int32
c
=
0
;
c
<
xseq
.
getLength
();
c
++
)
if
(
xseq
[
c
]
->
isDefaultConstructor
())
bHasDefault
=
true
;
try
{
if
(
bHasDefault
&&
s
[
i
]
!=
"com.sun.star.deployment.test.SmoketestCommandEnvironment"
)
// TODO: com.sun.star.deployment.test.SmoketestCommandEnvironment throws
// "Can not activate the factory for org.libreoffice.smoketest.SmoketestCommandEnvironment
// because java.lang.NoClassDefFoundError: com/sun/star/ucb/XCommandEnvironment"
m_xContext
->
getServiceManager
()
->
createInstanceWithContext
(
s
[
i
],
m_xContext
);
}
catch
(
const
Exception
&
e
)
{
OString
exc
=
"Exception thrown while creating "
+
OUStringToOString
(
s
[
i
]
+
": "
+
e
.
Message
,
RTL_TEXTENCODING_UTF8
);
CPPUNIT_FAIL
(
exc
.
getStr
());
}
}
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
ServicesTest
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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