test_reference.cxx (129fa3d1) | test_reference.cxx (4ad76906) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 14 unchanged lines hidden (view full) --- 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_cppu.hxx" 26 27#include "sal/config.h" 28 29#include "Interface1.hpp" 30 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 14 unchanged lines hidden (view full) --- 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_cppu.hxx" 26 27#include "sal/config.h" 28 29#include "Interface1.hpp" 30 |
31#include "testshl/simpleheader.hxx" | |
32#include "rtl/ustring.hxx" 33#include "sal/types.h" | 31#include "rtl/ustring.hxx" 32#include "sal/types.h" |
33#include "gtest/gtest.h" |
|
34 35namespace 36{ 37 38using ::com::sun::star::uno::Type; 39using ::com::sun::star::uno::Any; 40using ::com::sun::star::uno::Reference; 41using ::com::sun::star::uno::RuntimeException; --- 44 unchanged lines hidden (view full) --- 86private: 87 Foo(Foo &); // not declared 88 Foo& operator =(const Foo&); // not declared 89 90private: 91 oslInterlockedCount m_refCount; 92}; 93 | 34 35namespace 36{ 37 38using ::com::sun::star::uno::Type; 39using ::com::sun::star::uno::Any; 40using ::com::sun::star::uno::Reference; 41using ::com::sun::star::uno::RuntimeException; --- 44 unchanged lines hidden (view full) --- 86private: 87 Foo(Foo &); // not declared 88 Foo& operator =(const Foo&); // not declared 89 90private: 91 oslInterlockedCount m_refCount; 92}; 93 |
94class Test: public ::CppUnit::TestFixture | 94class Test: public ::testing::Test |
95{ 96 97public: | 95{ 96 97public: |
98 void testUnoSetThrow(); 99 100 CPPUNIT_TEST_SUITE(Test); 101 CPPUNIT_TEST(testUnoSetThrow); 102 CPPUNIT_TEST_SUITE_END(); | |
103}; 104 | 98}; 99 |
105void Test::testUnoSetThrow() | 100TEST_F(Test, testUnoSetThrow) |
106{ 107 Reference< Interface1 > xNull; 108 Reference< Interface1 > xFoo( new Foo ); 109 110 // ctor taking Reference< interface_type > 111 bool bCaughtException = false; 112 try { Reference< Interface1 > x( xNull, UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } | 101{ 102 Reference< Interface1 > xNull; 103 Reference< Interface1 > xFoo( new Foo ); 104 105 // ctor taking Reference< interface_type > 106 bool bCaughtException = false; 107 try { Reference< Interface1 > x( xNull, UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } |
113 CPPUNIT_ASSERT_EQUAL( true, bCaughtException ); | 108 ASSERT_EQ( true, bCaughtException ); |
114 115 bCaughtException = false; 116 try { Reference< Interface1 > x( xFoo, UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } | 109 110 bCaughtException = false; 111 try { Reference< Interface1 > x( xFoo, UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } |
117 CPPUNIT_ASSERT_EQUAL( false, bCaughtException ); | 112 ASSERT_EQ( false, bCaughtException ); |
118 119 // ctor taking interface_type* 120 bCaughtException = false; 121 try { Reference< Interface1 > x( xNull.get(), UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } | 113 114 // ctor taking interface_type* 115 bCaughtException = false; 116 try { Reference< Interface1 > x( xNull.get(), UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } |
122 CPPUNIT_ASSERT_EQUAL( true, bCaughtException ); | 117 ASSERT_EQ( true, bCaughtException ); |
123 124 bCaughtException = false; 125 try { Reference< Interface1 > x( xFoo.get(), UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } | 118 119 bCaughtException = false; 120 try { Reference< Interface1 > x( xFoo.get(), UNO_SET_THROW ); (void)x; } catch( const RuntimeException& ) { bCaughtException = true; } |
126 CPPUNIT_ASSERT_EQUAL( false, bCaughtException ); | 121 ASSERT_EQ( false, bCaughtException ); |
127 128 Reference< Interface1 > x; 129 // "set" taking Reference< interface_type > 130 bCaughtException = false; 131 try { x.set( xNull, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } | 122 123 Reference< Interface1 > x; 124 // "set" taking Reference< interface_type > 125 bCaughtException = false; 126 try { x.set( xNull, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } |
132 CPPUNIT_ASSERT_EQUAL( true, bCaughtException ); | 127 ASSERT_EQ( true, bCaughtException ); |
133 134 bCaughtException = false; 135 try { x.set( xFoo, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } | 128 129 bCaughtException = false; 130 try { x.set( xFoo, UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } |
136 CPPUNIT_ASSERT_EQUAL( false, bCaughtException ); | 131 ASSERT_EQ( false, bCaughtException ); |
137 138 // "set" taking interface_type* 139 bCaughtException = false; 140 try { x.set( xNull.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } | 132 133 // "set" taking interface_type* 134 bCaughtException = false; 135 try { x.set( xNull.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } |
141 CPPUNIT_ASSERT_EQUAL( true, bCaughtException ); | 136 ASSERT_EQ( true, bCaughtException ); |
142 143 bCaughtException = false; 144 try { x.set( xFoo.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } | 137 138 bCaughtException = false; 139 try { x.set( xFoo.get(), UNO_SET_THROW ); } catch( const RuntimeException& ) { bCaughtException = true; } |
145 CPPUNIT_ASSERT_EQUAL( false, bCaughtException ); | 140 ASSERT_EQ( false, bCaughtException ); |
146} 147 | 141} 142 |
148CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); 149 | |
150} // namespace | 143} // namespace |
151 152NOADDITIONAL; | |