1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "sal/config.h"
25 #include "rtl/string.hxx"
26 #include "rtl/textenc.h"
27 #include "rtl/ustring.hxx"
34 explicit CheckFailed(OUString
const & theMessage
): message(theMessage
)
40 ::std::ostream
& operator<< (::std::ostream
& os
, const OUString
& str
)
42 return os
<< OUStringToOString(str
, RTL_TEXTENCODING_UTF8
).getStr();
45 template< typename T
> void checkEqual(T
const & value
, T
const & argument
) {
46 if (argument
!= value
) {
48 s
<< value
<< " != " << argument
;
51 OString(s
.str().c_str()), RTL_TEXTENCODING_UTF8
));
57 namespace testtools
{ namespace bridgetest
{
60 com::sun::star::uno::Reference
< test::testtools::bridgetest::XMulti
>
66 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
67 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
70 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
71 multi
.get())->getatt1());
74 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
75 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
78 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
79 multi
.get())->getatt1());
82 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
83 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
84 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
85 multi
, css::uno::UNO_QUERY_THROW
)->setatt1(0.1);
88 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
89 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
92 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
93 multi
.get())->getatt1());
96 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
97 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
100 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
101 multi
.get())->getatt1());
104 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
105 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
106 checkEqual
< sal_Int32
>(
108 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
109 multi
, css::uno::UNO_QUERY_THROW
)->fn11(1));
110 checkEqual
< sal_Int32
>(
112 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
113 multi
.get())->fn11(1));
114 checkEqual
< sal_Int32
>(
116 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
117 multi
, css::uno::UNO_QUERY_THROW
)->fn11(2));
118 checkEqual
< sal_Int32
>(
120 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
121 multi
.get())->fn11(1));
122 checkEqual
< sal_Int32
>(
124 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
125 multi
, css::uno::UNO_QUERY_THROW
)->fn11(5));
127 OUString("12" "abc"),
128 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
129 multi
, css::uno::UNO_QUERY_THROW
)->fn12(
132 OUString("12" "abc-2"),
133 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
134 multi
.get())->fn12(OUString("abc-2")));
136 OUString("12" "abc-2"),
137 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
138 multi
, css::uno::UNO_QUERY_THROW
)->fn12(
141 OUString("12" "abc-5"),
142 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
143 multi
.get())->fn12(OUString("abc-5")));
145 OUString("12" "abc-5"),
146 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
147 multi
, css::uno::UNO_QUERY_THROW
)->fn12(
149 checkEqual
< sal_Int32
>(21 * 2, multi
->fn21(2));
152 multi
->fn22(OUString("de")));
153 checkEqual
< sal_Int32
>(
155 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
156 multi
, css::uno::UNO_QUERY_THROW
)->fn31(3));
157 checkEqual
< sal_Int32
>(
159 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
160 multi
.get())->fn31(5));
161 checkEqual
< sal_Int32
>(
163 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
164 multi
, css::uno::UNO_QUERY_THROW
)->fn31(5));
167 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
168 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
171 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
172 multi
.get())->getatt3());
175 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
176 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
177 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
178 multi
, css::uno::UNO_QUERY_THROW
)->setatt3(0.3);
181 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
182 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
185 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
186 multi
.get())->getatt3());
189 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
190 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
193 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
194 multi
, css::uno::UNO_QUERY_THROW
)->fn32(
197 OUString("32" "f-5"),
198 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
199 multi
.get())->fn32(OUString("f-5")));
201 OUString("32" "f-5"),
202 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
203 multi
, css::uno::UNO_QUERY_THROW
)->fn32(
205 checkEqual
< sal_Int32
>(
207 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
208 multi
, css::uno::UNO_QUERY_THROW
)->fn33());
209 checkEqual
< sal_Int32
>(
211 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
212 multi
.get())->fn33());
213 checkEqual
< sal_Int32
>(
215 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
216 multi
, css::uno::UNO_QUERY_THROW
)->fn33());
217 checkEqual
< sal_Int32
>(41 * 4, multi
->fn41(4));
218 checkEqual
< sal_Int32
>(61 * 6, multi
->fn61(6));
221 multi
->fn62(OUString()));
222 checkEqual
< sal_Int32
>(71 * 7, multi
->fn71(7));
225 multi
->fn72(OUString("g")));
226 checkEqual
< sal_Int32
>(73, multi
->fn73());
227 } catch (CheckFailed
const & f
) {
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */