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/textenc.h>
26 #include <rtl/ustring.hxx>
29 #include <string_view>
35 explicit CheckFailed(OUString theMessage
): message(std::move(theMessage
))
41 template< typename T
> void checkEqual(T
const & value
, T
const & argument
) {
42 if (argument
!= value
) {
44 s
<< value
<< " != " << argument
;
47 std::string_view(s
.str()), RTL_TEXTENCODING_UTF8
));
53 namespace testtools::bridgetest
{
55 OUString
testMulti( css::uno::Reference
< test::testtools::bridgetest::XMulti
> const & multi
)
60 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
61 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
64 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
65 multi
.get())->getatt1());
68 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
69 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
72 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
73 multi
.get())->getatt1());
76 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
77 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
78 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
79 multi
, css::uno::UNO_QUERY_THROW
)->setatt1(0.1);
82 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
83 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
86 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
87 multi
.get())->getatt1());
90 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
91 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
94 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
95 multi
.get())->getatt1());
98 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
99 multi
, css::uno::UNO_QUERY_THROW
)->getatt1());
100 checkEqual
< sal_Int32
>(
102 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
103 multi
, css::uno::UNO_QUERY_THROW
)->fn11(1));
104 checkEqual
< sal_Int32
>(
106 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
107 multi
.get())->fn11(1));
108 checkEqual
< sal_Int32
>(
110 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
111 multi
, css::uno::UNO_QUERY_THROW
)->fn11(2));
112 checkEqual
< sal_Int32
>(
114 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
115 multi
.get())->fn11(1));
116 checkEqual
< sal_Int32
>(
118 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
119 multi
, css::uno::UNO_QUERY_THROW
)->fn11(5));
121 OUString("12" "abc"),
122 css::uno::Reference
< test::testtools::bridgetest::XMultiBase1
>(
123 multi
, css::uno::UNO_QUERY_THROW
)->fn12(
126 OUString("12" "abc-2"),
127 static_cast< test::testtools::bridgetest::XMultiBase2
* >(
128 multi
.get())->fn12("abc-2"));
130 OUString("12" "abc-2"),
131 css::uno::Reference
< test::testtools::bridgetest::XMultiBase2
>(
132 multi
, css::uno::UNO_QUERY_THROW
)->fn12("abc-2"));
134 OUString("12" "abc-5"),
135 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
136 multi
.get())->fn12("abc-5"));
138 OUString("12" "abc-5"),
139 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
140 multi
, css::uno::UNO_QUERY_THROW
)->fn12("abc-5"));
141 checkEqual
< sal_Int32
>(21 * 2, multi
->fn21(2));
145 checkEqual
< sal_Int32
>(
147 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
148 multi
, css::uno::UNO_QUERY_THROW
)->fn31(3));
149 checkEqual
< sal_Int32
>(
151 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
152 multi
.get())->fn31(5));
153 checkEqual
< sal_Int32
>(
155 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
156 multi
, css::uno::UNO_QUERY_THROW
)->fn31(5));
159 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
160 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
163 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
164 multi
.get())->getatt3());
167 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
168 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
169 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
170 multi
, css::uno::UNO_QUERY_THROW
)->setatt3(0.3);
173 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
174 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
177 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
178 multi
.get())->getatt3());
181 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
182 multi
, css::uno::UNO_QUERY_THROW
)->getatt3());
185 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
186 multi
, css::uno::UNO_QUERY_THROW
)->fn32("f"));
188 OUString("32" "f-5"),
189 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
190 multi
.get())->fn32("f-5"));
192 OUString("32" "f-5"),
193 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
194 multi
, css::uno::UNO_QUERY_THROW
)->fn32("f-5"));
195 checkEqual
< sal_Int32
>(
197 css::uno::Reference
< test::testtools::bridgetest::XMultiBase3
>(
198 multi
, css::uno::UNO_QUERY_THROW
)->fn33());
199 checkEqual
< sal_Int32
>(
201 static_cast< test::testtools::bridgetest::XMultiBase5
* >(
202 multi
.get())->fn33());
203 checkEqual
< sal_Int32
>(
205 css::uno::Reference
< test::testtools::bridgetest::XMultiBase5
>(
206 multi
, css::uno::UNO_QUERY_THROW
)->fn33());
207 checkEqual
< sal_Int32
>(41 * 4, multi
->fn41(4));
208 checkEqual
< sal_Int32
>(61 * 6, multi
->fn61(6));
211 multi
->fn62(OUString()));
212 checkEqual
< sal_Int32
>(71 * 7, multi
->fn71(7));
216 checkEqual
< sal_Int32
>(73, multi
->fn73());
217 } catch (CheckFailed
const & f
) {
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */