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
88b9ee66
Kaydet (Commit)
88b9ee66
authored
Mar 13, 2001
tarafından
Daniel Boelzle
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
better test
üst
e4814d8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
49 deletions
+70
-49
test_di.cxx
cppu/test/test_di.cxx
+70
-49
No files found.
cppu/test/test_di.cxx
Dosyayı görüntüle @
88b9ee66
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: test_di.cxx,v $
* $RCSfile: test_di.cxx,v $
*
*
* $Revision: 1.
3
$
* $Revision: 1.
4
$
*
*
* last change: $Author:
jl $ $Date: 2001-03-12 13:28:13
$
* last change: $Author:
dbo $ $Date: 2001-03-13 10:05:20
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -189,12 +189,25 @@ void assign( test::TestData & rData,
...
@@ -189,12 +189,25 @@ void assign( test::TestData & rData,
rData
.
Sequence
=
rSequence
;
rData
.
Sequence
=
rSequence
;
}
}
//==================================================================================================
class
TestDummy
:
public
OWeakObject
{
public
:
sal_Int32
getRefCount
()
const
{
return
m_refCount
;
}
virtual
~
TestDummy
()
{
OSL_TRACE
(
"> scalar TestDummy dtor <
\n
"
);
}
};
//==================================================================================================
//==================================================================================================
class
Test_Impl
:
public
cppu
::
WeakImplHelper1
<
XLanguageBindingTest
>
class
Test_Impl
:
public
cppu
::
WeakImplHelper1
<
XLanguageBindingTest
>
{
{
test
::
TestData
_aData
,
_aStructData
;
test
::
TestData
_aData
,
_aStructData
;
public
:
public
:
sal_Int32
getRefCount
()
const
{
return
m_refCount
;
}
virtual
~
Test_Impl
()
virtual
~
Test_Impl
()
{
OSL_TRACE
(
"> scalar Test_Impl dtor <
\n
"
);
}
{
OSL_TRACE
(
"> scalar Test_Impl dtor <
\n
"
);
}
...
@@ -383,39 +396,41 @@ test::TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_In
...
@@ -383,39 +396,41 @@ test::TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_In
}
}
//==================================================================================================
//==================================================================================================
sal_Bool
performTest
(
const
Reference
<
XLanguageBindingTest
>
&
xLBT
)
static
sal_Bool
performTest
(
const
Reference
<
XLanguageBindingTest
>
&
xLBT
,
const
Reference
<
XInterface
>
&
xDummyInterface
)
{
{
OSL_ENSURE
(
xLBT
.
is
()
,
"### no test interface
!"
);
OSL_ENSURE
(
xLBT
.
is
()
&&
xDummyInterface
.
is
(),
"### no test interfaces
!"
);
if
(
xLBT
.
is
())
if
(
xLBT
.
is
()
&&
xDummyInterface
.
is
()
)
{
{
// this data is never ever granted access to by calls other than equals(), assign()!
// this data is never ever granted access to by calls other than equals(), assign()!
test
::
TestData
aData
;
// test against this data
test
::
TestData
aData
;
// test against this data
Reference
<
XInterface
>
xI
(
*
new
OWeakObject
()
);
assign
(
(
test
::
TestElement
&
)
aData
,
assign
(
(
test
::
TestElement
&
)
aData
,
sal_True
,
'@'
,
17
,
0x1234
,
0xfedc
,
0x12345678
,
0xfedcba98
,
sal_True
,
'@'
,
17
,
0x1234
,
0xfedc
,
0x12345678
,
0xfedcba98
,
0x123456789abcdef0
,
0xfedcba9876543210
,
0x123456789abcdef0
,
0xfedcba9876543210
,
(
float
)
17.0815
,
3.1415926359
,
TestEnum_LOLA
,
(
float
)
17.0815
,
3.1415926359
,
TestEnum_LOLA
,
OUString
::
createFromAscii
(
"dumdidum"
),
xI
,
OUString
::
createFromAscii
(
"dumdidum"
),
xDummyInterface
,
Any
(
&
xI
,
::
getCppuType
(
(
const
Reference
<
XInterface
>
*
)
0
)
)
);
makeAny
(
xDummyInterface
)
);
OSL_ENSURE
(
aData
.
Any
==
xI
,
"### unexpected any!"
);
OSL_ENSURE
(
!
(
aData
.
Any
!=
xI
),
"### unexpected any!"
);
aData
.
Sequence
=
Sequence
<
test
::
TestElement
>
(
(
const
test
::
TestElement
*
)
&
aData
,
1
);
aData
.
Sequence
=
Sequence
<
test
::
TestElement
>
(
(
const
test
::
TestElement
*
)
&
aData
,
1
);
// aData complete
OSL_ENSURE
(
aData
.
Any
==
xDummyInterface
,
"### unexpected any!"
);
OSL_ENSURE
(
!
(
aData
.
Any
!=
xDummyInterface
),
"### unexpected any!"
);
// aData complete ==> never touched again
//================================================================================
//================================================================================
// this is a manually copy of aData for first setting...
// this is a manually copy of aData for first setting...
test
::
TestData
aSetData
;
test
::
TestData
aSetData0
(
aData
);
// copy ctor
// assignment
test
::
TestData
aSetData1
=
aSetData0
;
test
::
TestData
aSetData
;
assign
(
(
test
::
TestElement
&
)
aSetData
,
assign
(
(
test
::
TestElement
&
)
aSetData
,
a
Data
.
Bool
,
aData
.
Char
,
aData
.
Byte
,
aData
.
Short
,
aData
.
UShort
,
a
SetData1
.
Bool
,
aSetData1
.
Char
,
aSetData1
.
Byte
,
aSetData1
.
Short
,
aSetData1
.
UShort
,
a
Data
.
Long
,
aData
.
ULong
,
aData
.
Hyper
,
aData
.
UHyper
,
aData
.
Float
,
aData
.
Double
,
a
SetData1
.
Long
,
aSetData1
.
ULong
,
aSetData1
.
Hyper
,
aSetData1
.
UHyper
,
a
Data
.
Enum
,
aData
.
String
,
xI
,
a
SetData1
.
Float
,
aSetData1
.
Double
,
Any
(
&
xI
,
::
getCppuType
(
(
const
Reference
<
XInterface
>
*
)
0
)
)
);
aSetData1
.
Enum
,
aSetData1
.
String
,
aSetData1
.
Interface
,
aSetData1
.
Any
);
// switch over to new sequence allocation
aSetData
.
Sequence
=
Sequence
<
test
::
TestElement
>
(
(
const
test
::
TestElement
*
)
&
aSetData
,
1
);
aSetData
.
Sequence
=
Sequence
<
test
::
TestElement
>
(
(
const
test
::
TestElement
*
)
&
aSetData
,
1
);
xLBT
->
setValues
(
xLBT
->
setValues
(
...
@@ -577,42 +592,48 @@ sal_Bool raiseException( const Reference< XLanguageBindingTest > & xLBT )
...
@@ -577,42 +592,48 @@ sal_Bool raiseException( const Reference< XLanguageBindingTest > & xLBT )
//==================================================================================================
//==================================================================================================
void
test_di
(
void
)
void
test_di
(
void
)
{
{
Test
_Impl
*
p
=
new
Test_Impl
();
Test
Dummy
*
p
=
new
TestDummy
();
Reference
<
XInterface
>
x
(
*
p
);
Reference
<
XInterface
>
x
Dummy
(
*
p
);
{
{
Reference
<
XLanguageBindingTest
>
xOriginal
(
x
,
UNO_QUERY
);
Test_Impl
*
p
=
new
Test_Impl
();
Reference
<
XLanguageBindingTest
>
xLBT
;
Reference
<
XInterface
>
x
(
*
p
);
{
Reference
<
XLanguageBindingTest
>
xOriginal
(
x
,
UNO_QUERY
);
Reference
<
XLanguageBindingTest
>
xLBT
;
uno_Environment
*
pCppEnv1
=
0
;
uno_Environment
*
pCppEnv1
=
0
;
uno_Environment
*
pCppEnv2
=
0
;
uno_Environment
*
pCppEnv2
=
0
;
OUString
aCppEnvTypeName
(
RTL_CONSTASCII_USTRINGPARAM
(
CPPU_CURRENT_LANGUAGE_BINDING_NAME
)
);
OUString
aCppEnvTypeName
(
RTL_CONSTASCII_USTRINGPARAM
(
CPPU_CURRENT_LANGUAGE_BINDING_NAME
)
);
uno_getEnvironment
(
&
pCppEnv1
,
aCppEnvTypeName
.
pData
,
0
);
uno_getEnvironment
(
&
pCppEnv1
,
aCppEnvTypeName
.
pData
,
0
);
uno_createEnvironment
(
&
pCppEnv2
,
aCppEnvTypeName
.
pData
,
0
);
// anonymous
uno_createEnvironment
(
&
pCppEnv2
,
aCppEnvTypeName
.
pData
,
0
);
// anonymous
Mapping
aMapping
(
pCppEnv1
,
pCppEnv2
,
OUString
::
createFromAscii
(
"prot"
)
);
Mapping
aMapping
(
pCppEnv1
,
pCppEnv2
,
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"prot"
)
)
);
aMapping
.
mapInterface
(
(
void
**
)
&
xLBT
,
xOriginal
.
get
(),
::
getCppuType
(
&
xOriginal
)
);
aMapping
.
mapInterface
(
(
void
**
)
&
xLBT
,
xOriginal
.
get
(),
::
getCppuType
(
&
xOriginal
)
);
OSL_ENS
URE
(
aMapping
.
is
(),
"### cannot get mapping!"
);
OSL_ENSH
URE
(
aMapping
.
is
(),
"### cannot get mapping!"
);
(
*
pCppEnv2
->
release
)(
pCppEnv2
);
(
*
pCppEnv2
->
release
)(
pCppEnv2
);
(
*
pCppEnv1
->
release
)(
pCppEnv1
);
(
*
pCppEnv1
->
release
)(
pCppEnv1
);
OSL_ASSERT
(
xLBT
.
is
()
);
OSL_ASSERT
(
xLBT
.
is
()
);
if
(
xLBT
.
is
()
&&
performTest
(
xLBT
))
if
(
xLBT
.
is
()
&&
performTest
(
xLBT
,
xDummy
))
{
{
if
(
raiseException
(
xLBT
))
if
(
raiseException
(
xLBT
))
{
{
printf
(
"> dynamic invocation test succeeded!
\n
"
);
printf
(
"> dynamic invocation test succeeded!
\n
"
);
}
}
else
else
{
{
printf
(
"> exception test failed!
\n
"
);
printf
(
"> exception test failed!
\n
"
);
}
}
else
{
printf
(
"> dynamic invocation test failed!
\n
"
);
}
}
}
OSL_ENSURE
(
p
->
getRefCount
()
==
1
,
"### test object ref count > 1 !"
);
}
}
else
OSL_ENSURE
(
p
->
getRefCount
()
==
1
,
"### dummy object ref count > 1 !"
);
{
printf
(
"> dynamic invocation test failed!
\n
"
);
}
}
}
}
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