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
e67b072c
Kaydet (Commit)
e67b072c
authored
May 07, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid warnings about unused test functions
Change-Id: I6b2a40c4b95555c4d8bf0d8674fce46accd49965
üst
904b3d1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
43 deletions
+49
-43
test_reference.cxx
cppu/qa/test_reference.cxx
+49
-43
No files found.
cppu/qa/test_reference.cxx
Dosyayı görüntüle @
e67b072c
...
...
@@ -89,14 +89,55 @@ private:
oslInterlockedCount
m_refCount
;
};
// Check that the up-casting Reference conversion constructor catches the
// intended cases:
struct
Base1
:
public
css
::
uno
::
XInterface
{
virtual
~
Base1
()
{}
};
struct
Base2
:
public
Base1
{
virtual
~
Base2
()
{}
};
struct
Base3
:
public
Base1
{
virtual
~
Base3
()
{}
};
struct
Derived
:
public
Base2
,
public
Base3
{
virtual
~
Derived
()
{}
};
// The special case using the conversion operator instead:
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
testUpcast1
(
css
::
uno
::
Reference
<
Derived
>
const
&
ref
)
{
return
ref
;
}
// The normal up-cast case:
css
::
uno
::
Reference
<
Base1
>
testUpcast2
(
css
::
uno
::
Reference
<
Base2
>
const
&
ref
)
{
return
ref
;
}
// Commenting this in should cause a compiler error due to an ambiguous up-cast:
/*
css::uno::Reference< Base1 > testFailingUpcast3(
css::uno::Reference< Derived > const & ref)
{ return ref; }
*/
// Commenting this in should cause a compiler error due to a down-cast:
/*
css::uno::Reference< Base2 > testFailingUpcast4(
css::uno::Reference< Base1 > const & ref)
{ return ref; }
*/
// Commenting this in should cause a compiler error due to a down-cast:
/*
css::uno::Reference< Base1 > testFailingUpcast5(
css::uno::Reference< css::uno::XInterface > const & ref)
{ return ref; }
*/
class
Test
:
public
::
CppUnit
::
TestFixture
{
public
:
void
testUnoSetThrow
();
void
testUpcastCompilation
();
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST
(
testUnoSetThrow
);
CPPUNIT_TEST
(
testUpcastCompilation
);
CPPUNIT_TEST_SUITE_END
();
};
...
...
@@ -143,53 +184,18 @@ void Test::testUnoSetThrow()
CPPUNIT_ASSERT_EQUAL
(
false
,
bCaughtException
);
}
// Include a dummy test calling those functions, to avoid warnings about those
// functions being unused:
void
Test
::
testUpcastCompilation
()
{
testUpcast1
(
css
::
uno
::
Reference
<
Derived
>
());
testUpcast2
(
css
::
uno
::
Reference
<
Base2
>
());
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
}
// namespace
CPPUNIT_PLUGIN_IMPLEMENT
();
// Check that the up-casting Reference conversion constructor catches the
// intended cases:
namespace
{
struct
Base1
:
public
css
::
uno
::
XInterface
{
virtual
~
Base1
()
{}
};
struct
Base2
:
public
Base1
{
virtual
~
Base2
()
{}
};
struct
Base3
:
public
Base1
{
virtual
~
Base3
()
{}
};
struct
Derived
:
public
Base2
,
public
Base3
{
virtual
~
Derived
()
{}
};
}
// The special case using the conversion operator instead:
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
testUpcast1
(
css
::
uno
::
Reference
<
Derived
>
const
&
ref
)
{
return
ref
;
}
// The normal up-cast case:
css
::
uno
::
Reference
<
Base1
>
testUpcast2
(
css
::
uno
::
Reference
<
Base2
>
const
&
ref
)
{
return
ref
;
}
// Commenting this in should cause a compiler error due to an ambiguous up-cast:
/*
css::uno::Reference< Base1 > testFailingUpcast3(
css::uno::Reference< Derived > const & ref)
{ return ref; }
*/
// Commenting this in should cause a compiler error due to a down-cast:
/*
css::uno::Reference< Base2 > testFailingUpcast4(
css::uno::Reference< Base1 > const & ref)
{ return ref; }
*/
// Commenting this in should cause a compiler error due to a down-cast:
/*
css::uno::Reference< Base1 > testFailingUpcast5(
css::uno::Reference< css::uno::XInterface > const & ref)
{ return ref; }
*/
/* 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