cppu/qa/test_reference.cxx |   92 +++++++++++++++++++++++----------------------
 1 file changed, 49 insertions(+), 43 deletions(-)

New commits:
commit e67b072c8e7a2b6d2c9afcf72882083255ef5966
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue May 7 10:14:01 2013 +0200

    Avoid warnings about unused test functions
    
    Change-Id: I6b2a40c4b95555c4d8bf0d8674fce46accd49965

diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx
index a6e3936..ab3bac5 100644
--- a/cppu/qa/test_reference.cxx
+++ b/cppu/qa/test_reference.cxx
@@ -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: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to