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 .
20 #include
<com
/sun
/star
/lang
/IllegalArgumentException.idl
>
21 #include
<com
/sun
/star
/lang
/XComponent.idl
>
22 #include
<com
/sun
/star
/uno
/XComponentContext.idl
>
23 #include
<com
/sun
/star
/uno
/XInterface.idl
>
25 module test
{ module testtools
{ module bridgetest
{
38 enum TestBadEnum
{ M
= 1 };
56 unsigned short UShort
;
60 unsigned hyper UHyper
;
66 * equal to max size returned in registers on x86_64
74 * equal to max size returned in registers on ia64
84 * bigger than max size returned in registers on ia64
98 * two floats, BSDs/MacOSX on intel handle returning small
99 * structs differently than Linux
107 * all floats, ia64 handles them specially
117 * Small struct with mixed float and integers.
118 * Should return in registers on BSDs/MACOSx
120 struct MixedFloatAndInteger
129 struct FloatFloatLongByte
{
136 * Small struct with three bytes. Should *not* return in registers on
139 struct ThreeByteStruct
146 * complex types adding string, interface, any
148 struct TestElement
: TestSimple
151 com
::sun
::star
::uno
::XInterface
Interface;
155 * adding even more complexity, sequence< TestElement >
157 struct TestDataElements
: TestElement
159 sequence
< TestElement
> Sequence
;
163 * typedef used in interface
165 typedef TestDataElements TestData
;
167 struct TestPolyStruct
<T
> { T member
; };
168 struct TestPolyStruct2
<T
,C
> {
173 interface XRecursiveCall
: com
::sun
::star
::uno
::XInterface
176 * @param nToCall If nToCall is 0, the method returns immediately.
177 * Otherwise, call the given interface with nToCall -1
180 void callRecursivly
( [in] XRecursiveCall xCall
, [in] long nToCall
);
183 interface XMultiBase1
{
184 [attribute
] double att1
; // initially 0.0
185 long fn11
([in] long arg
); // return 11 * arg
186 string fn12
([in] string arg
); // return "12" + arg
189 interface XMultiBase2
: XMultiBase1
{
190 long fn21
([in] long arg
); // return 21 * arg
191 string fn22
([in] string arg
); // return "22" + arg
194 interface XMultiBase3
{
195 [attribute
] double att3
; // initially 0.0
196 long fn31
([in] long arg
); // return 31 * arg
197 string fn32
([in] string arg
); // return "32" + arg
198 long fn33
(); // return 33
201 interface XMultiBase3a
: XMultiBase3
{};
203 interface XMultiBase4
{
204 long fn41
([in] long arg
); // return 41 * arg
207 interface XMultiBase5
{
208 interface XMultiBase3
;
209 interface XMultiBase4
;
210 interface XMultiBase1
;
213 interface XMultiBase6
{
214 interface XMultiBase2
;
215 interface XMultiBase3a
;
216 interface XMultiBase5
;
217 long fn61
([in] long arg
); // return 61 * arg
218 string fn62
([in] string arg
); // return "62" + arg
221 interface XMultiBase7
{
222 long fn71
([in] long arg
); // return 71 * arg
223 string fn72
([in] string arg
); // return "72" + arg
224 long fn73
(); // return 73
228 interface XMultiBase6
;
229 interface XMultiBase7
;
233 * Monster test interface to test bridge calls.
234 * An implementation of this object has to store given values and return whenever there
235 * is an out param or return value.
237 interface XBridgeTestBase
: com
::sun
::star
::uno
::XInterface
240 * in parameter test, tests by calls reference also (complex types)
242 void setValues
( [in] boolean bBool
,
246 [in] unsigned short nUShort
,
248 [in] unsigned long nULong
,
250 [in] unsigned hyper nUHyper
,
257 [in] com
::sun
::star
::uno
::XInterface xInterface
,
259 [in] sequence
< TestElement
> aSequence
,
260 [in] TestData aStruct
);
262 * inout parameter test
264 * @return aStruct. The out parameter contain the values, that were previously set
265 * by setValues or (if not called before) default constructed values.
268 TestData setValues2
( [inout
] boolean bBool
,
271 [inout
] short nShort
,
272 [inout
] unsigned short nUShort
,
274 [inout
] unsigned long nULong
,
275 [inout
] hyper nHyper
,
276 [inout
] unsigned hyper nUHyper
,
277 [inout
] float fFloat
,
278 [inout
] double fDouble
,
279 [inout
] TestEnum eEnum
,
280 [inout
] string aString
,
282 [inout
] short aShort2
,
283 [inout
] com
::sun
::star
::uno
::XInterface xInterface
,
285 [inout
] sequence
< TestElement
> aSequence
,
286 [inout
] TestData aStruct
);
291 TestData getValues
( [out] boolean bBool
,
295 [out] unsigned short nUShort
,
297 [out] unsigned long nULong
,
299 [out] unsigned hyper nUHyper
,
301 [out] double fDouble
,
302 [out] TestEnum eEnum
,
303 [out] string aString
,
306 [out] com
::sun
::star
::uno
::XInterface xInterface
,
308 [out] sequence
< TestElement
> aSequence
,
309 [out] TestData aStruct
);
312 * register return test 1
314 SmallStruct echoSmallStruct
( [in] SmallStruct aStruct
);
317 * register return test 2
319 MediumStruct echoMediumStruct
( [in] MediumStruct aStruct
);
322 * register return test 3
324 BigStruct echoBigStruct
( [in] BigStruct aStruct
);
327 * register return test 4
329 TwoFloats echoTwoFloats
( [in] TwoFloats aStruct
);
332 * register return test 5
334 FourFloats echoFourFloats
( [in] FourFloats aStruct
);
337 * register return test 6
339 MixedFloatAndInteger echoMixedFloatAndInteger
( [in] MixedFloatAndInteger aStruct
);
341 DoubleHyper echoDoubleHyper
([in] DoubleHyper s
);
343 FloatFloatLongByte echoFloatFloatLongByte
([in] FloatFloatLongByte s
);
346 * register return test 7
348 ThreeByteStruct echoThreeByteStruct
( [in] ThreeByteStruct aStruct
);
351 * PPC Alignment test (#i107182#)
353 long testPPCAlignment
( [in] hyper l1
, [in] hyper l2
, [in] long i1
, [in] hyper l3
, [in] long i2
);
356 * PPC64 Alignment test
358 long testPPC64Alignment
( [in] double d1
, [in] double d2
, [in] double d3
, [in] long i1
);
362 * VFP ABI (armhf) doubles test
364 double testTenDoubles
( [in] double d1
, [in] double d2
, [in] double d3
, [in] double d4
, [in] double d5
, [in] double d6
, [in] double d7
, [in] double d8
, [in] double d9
, [in] double d10
);
366 [attribute
] boolean Bool
;
367 [attribute
] byte Byte;
368 [attribute
] char Char;
369 [attribute
] short Short;
370 [attribute
] unsigned short UShort
;
371 [attribute
] long Long;
372 [attribute
] unsigned long ULong
;
373 [attribute
] hyper Hyper;
374 [attribute
] unsigned hyper UHyper
;
375 [attribute
] float Float;
376 [attribute
] double Double;
377 [attribute
] TestEnum
Enum;
378 [attribute
] string String;
379 [attribute
] byte Byte2
;
380 [attribute
] short Short2
;
381 [attribute
] com
::sun
::star
::uno
::XInterface
Interface;
383 [attribute
] sequence
< TestElement
> Sequence
;
384 [attribute
] TestData
Struct;
386 [attribute
] long RaiseAttr1
{
387 set raises
(com
::sun
::star
::lang
::IllegalArgumentException
);
389 [attribute
, readonly] long RaiseAttr2
{
390 get raises
(com
::sun
::star
::lang
::IllegalArgumentException
);
393 TestPolyStruct
<boolean> transportPolyBoolean
(
394 [in] TestPolyStruct
<boolean> arg
);
395 void transportPolyHyper
([inout
] TestPolyStruct
<hyper> arg
);
396 void transportPolySequence
(
397 [in] TestPolyStruct
<sequence
<any
> > arg1
,
398 [out] TestPolyStruct
<sequence
<any
> > arg2
);
400 TestPolyStruct
<long> getNullPolyLong
();
401 TestPolyStruct
<string> getNullPolyString
();
402 TestPolyStruct
<type
> getNullPolyType
();
403 TestPolyStruct
<any
> getNullPolyAny
();
404 TestPolyStruct
<sequence
<boolean> > getNullPolySequence
();
405 TestPolyStruct
<TestEnum
> getNullPolyEnum
();
406 TestPolyStruct
<TestBadEnum
> getNullPolyBadEnum
();
407 TestPolyStruct
<TestStruct
> getNullPolyStruct
();
408 TestPolyStruct
<XBridgeTestBase
> getNullPolyInterface
();
411 * This method returns the parameter value.
412 * Method to extensively test anys.
414 any transportAny
( [in] any value
);
417 * methods to check sequence of calls. Call call() and callOneway
418 * in an arbitrary sequence. Increase the callId for every call.
419 * The testobject sets an error flag.
421 @see testSequencePassed
423 void call
( [in] long nCallId
, [in] long nWaitMUSEC
);
424 void callOneway
( [in] long nCallId
, [in] long nWaitMUSEC
);
425 boolean sequenceOfCallTestPassed
();
428 * methods to check, if threads thread identity is holded.
431 void startRecursiveCall
( [in] XRecursiveCall xCall
, [in] long nToCall
);
434 string testMulti
([in] XMulti multi
);
439 * Inheriting from monster; adds raiseException(), attribute raising RuntimeException.
441 interface XBridgeTest
: XBridgeTestBase
444 * the exception struct returned has to be filled with given arguments.
445 * return value is for dummy.
447 TestData raiseException
( [in] short ArgumentPosition
,
449 [in] com
::sun
::star
::uno
::XInterface Context
)
450 raises
( com
::sun
::star
::lang
::IllegalArgumentException
);
454 * Throws runtime exception.
455 * check remote bridges handle exceptions during oneway calls properly.
456 * Note that on client side the exception may fly or not. When it flies, it should
457 * have the proper message and context.
459 void raiseRuntimeExceptionOneway
( [in] string Message,
460 [in] com
::sun
::star
::uno
::XInterface Context
);
463 * raises runtime exception;
464 * the exception struct returned has to be filled with formerly set test data.
466 [attribute
] long RuntimeException
;
470 exception BadConstructorArguments
: com
::sun
::star
::uno
::Exception
{};
472 service Constructors
: com
::sun
::star
::uno
::XInterface
{
477 [in] unsigned short arg3
,
479 [in] unsigned long arg5
,
481 [in] unsigned hyper arg7
,
488 [in] sequence
< boolean > arg14
,
489 [in] sequence
< byte > arg15
,
490 [in] sequence
< short > arg16
,
491 [in] sequence
< unsigned short > arg17
,
492 [in] sequence
< long > arg18
,
493 [in] sequence
< unsigned long > arg19
,
494 [in] sequence
< hyper > arg20
,
495 [in] sequence
< unsigned hyper > arg21
,
496 [in] sequence
< float > arg22
,
497 [in] sequence
< double > arg23
,
498 [in] sequence
< char > arg24
,
499 [in] sequence
< string > arg25
,
500 [in] sequence
< type
> arg26
,
501 [in] sequence
< any
> arg27
,
502 [in] sequence
< sequence
< boolean > > arg28
,
503 [in] sequence
< sequence
< any
> > arg29
,
504 [in] sequence
< TestEnum
> arg30
,
505 [in] sequence
< TestStruct
> arg31
,
506 [in] sequence
< TestPolyStruct
< boolean > > arg32
,
507 [in] sequence
< TestPolyStruct
< any
> > arg33
,
508 [in] sequence
< com
::sun
::star
::uno
::XInterface
> arg34
,
510 [in] TestStruct arg36
,
511 [in] TestPolyStruct
< boolean > arg37
,
512 [in] TestPolyStruct
< any
> arg38
,
513 [in] com
::sun
::star
::uno
::XInterface arg39
)
514 raises
(BadConstructorArguments
);
516 create2
([in] any... args
) raises
(BadConstructorArguments
);
520 service Constructors2
: XMultiBase1
{
523 [in] TestPolyStruct
<type
> arg1
,
524 [in] TestPolyStruct
<any
> arg2
,
525 [in] TestPolyStruct
<boolean> arg3
,
526 [in] TestPolyStruct
<byte> arg4
,
527 [in] TestPolyStruct
<short> arg5
,
528 [in] TestPolyStruct
<long> arg6
,
529 [in] TestPolyStruct
<hyper> arg7
,
530 [in] TestPolyStruct
<char> arg8
,
531 [in] TestPolyStruct
<string> arg9
,
532 [in] TestPolyStruct
<float> arg10
,
533 [in] TestPolyStruct
<double> arg11
,
534 [in] TestPolyStruct
<com
::sun
::star
::uno
::XInterface
> arg12
,
535 [in] TestPolyStruct
<com
::sun
::star
::lang
::XComponent
> arg13
,
536 [in] TestPolyStruct
<TestEnum
> arg14
,
537 [in] TestPolyStruct
<TestPolyStruct2
<char,any
> > arg15
,
538 [in] TestPolyStruct
<TestPolyStruct2
<TestPolyStruct2
<char,any
>,string> > arg16
,
539 [in] TestPolyStruct2
<string, TestPolyStruct2
<char, TestPolyStruct
<any
> > > arg17
,
540 [in] TestPolyStruct2
<TestPolyStruct2
<char,any
>, TestPolyStruct
<char> > arg18
,
541 [in] TestPolyStruct
<sequence
<type
> > arg19
,
542 [in] TestPolyStruct
<sequence
<any
> > arg20
,
543 [in] TestPolyStruct
<sequence
<boolean> > arg21
,
544 [in] TestPolyStruct
<sequence
<byte> > arg22
,
545 [in] TestPolyStruct
<sequence
<short> > arg23
,
546 [in] TestPolyStruct
<sequence
<long> > arg24
,
547 [in] TestPolyStruct
<sequence
<hyper> > arg25
,
548 [in] TestPolyStruct
<sequence
<char> > arg26
,
549 [in] TestPolyStruct
<sequence
<string> > arg27
,
550 [in] TestPolyStruct
<sequence
<float> > arg28
,
551 [in] TestPolyStruct
<sequence
<double> > arg29
,
552 [in] TestPolyStruct
<sequence
<com
::sun
::star
::uno
::XInterface
> > arg30
,
553 [in] TestPolyStruct
<sequence
<com
::sun
::star
::lang
::XComponent
> > arg31
,
554 [in] TestPolyStruct
<sequence
<TestEnum
> > arg32
,
555 [in] TestPolyStruct
<sequence
<TestPolyStruct2
<char, sequence
<any
> > > > arg33
,
556 [in] TestPolyStruct
<sequence
<TestPolyStruct2
<TestPolyStruct
<char>, sequence
<any
> > > > arg34
,
557 [in] TestPolyStruct
<sequence
<sequence
<long> > > arg35
,
558 [in] sequence
<TestPolyStruct
<long > > arg36
,
559 [in] sequence
<TestPolyStruct
<TestPolyStruct2
<char,any
> > > arg37
,
560 [in] sequence
<TestPolyStruct
<TestPolyStruct2
<TestPolyStruct2
<char,any
>,string> > > arg38
,
561 [in] sequence
<TestPolyStruct2
<string, TestPolyStruct2
<char, TestPolyStruct
<any
> > > > arg39
,
562 [in] sequence
<TestPolyStruct2
<TestPolyStruct2
<char,any
>, TestPolyStruct
<char> > > arg40
,
563 [in] sequence
<sequence
<TestPolyStruct
< char > > > arg41
,
564 [in] sequence
<sequence
<TestPolyStruct
<TestPolyStruct2
<char,any
> > > >arg42
,
565 [in] sequence
<sequence
<TestPolyStruct
<TestPolyStruct2
<TestPolyStruct2
<char,any
>,string> > > > arg43
,
566 [in] sequence
<sequence
<TestPolyStruct2
<string, TestPolyStruct2
<char, TestPolyStruct
<any
> > > > > arg44
,
567 [in] sequence
<sequence
<TestPolyStruct2
<TestPolyStruct2
<char,any
>, TestPolyStruct
<char> > > > arg45
571 interface XCurrentContextChecker
{
573 [in] XCurrentContextChecker other
, [in] long setSteps
,
574 [in] long checkSteps
);
577 /** Extended tests with sequences.
579 interface XBridgeTest2
: XBridgeTest
581 sequence
< boolean > setSequenceBool
( [in] sequence
< boolean > aSeq
);
582 sequence
< char > setSequenceChar
( [in] sequence
< char > aSeq
);
583 sequence
< byte> setSequenceByte
( [in] sequence
< byte > aSeq
);
584 sequence
< short> setSequenceShort
( [in] sequence
< short > aSeq
);
585 sequence
< unsigned short > setSequenceUShort
( [in] sequence
< unsigned short > aSeq
);
586 sequence
< long > setSequenceLong
( [in] sequence
< long > aSeq
);
587 sequence
< unsigned long > setSequenceULong
( [in] sequence
< unsigned long > aSeq
);
588 sequence
< hyper > setSequenceHyper
( [in] sequence
< hyper > aSeq
);
589 sequence
< unsigned hyper > setSequenceUHyper
( [in] sequence
< unsigned hyper > aSeq
);
590 sequence
< float > setSequenceFloat
( [in] sequence
< float > aSeq
);
591 sequence
< double > setSequenceDouble
( [in] sequence
< double > aSeq
);
592 sequence
< TestEnum
> setSequenceEnum
( [in] sequence
< TestEnum
> aSeq
);
593 sequence
< string > setSequenceString
( [in] sequence
< string > aString
);
594 sequence
< com
::sun
::star
::uno
::XInterface
> setSequenceXInterface
(
595 [in] sequence
< com
::sun
::star
::uno
::XInterface
> aSeq
);
596 sequence
< any
> setSequenceAny
( [in] sequence
< any
> aSeq
);
597 sequence
< TestElement
> setSequenceStruct
( [in] sequence
< TestElement
> aSeq
);
599 sequence
< sequence
< long > > setDim2
( [in] sequence
< sequence
< long > > aSeq
);
600 sequence
< sequence
< sequence
< long > > > setDim3
(
601 [in] sequence
< sequence
< sequence
< long > > > aSeq
);
603 void setSequencesInOut
( [inout
] sequence
< boolean > aSeqBoolean
,
604 [inout
] sequence
< char > aSeqChar
,
605 [inout
] sequence
< byte > aSeqByte
,
606 [inout
] sequence
< short > aSeqShort
,
607 [inout
] sequence
< unsigned short> aSeqUShort
,
608 [inout
] sequence
< long > aSeqLong
,
609 [inout
] sequence
< unsigned long > aSeqULong
,
610 [inout
] sequence
< hyper > aSeqHyper
,
611 [inout
] sequence
< unsigned hyper > aSeqUHyper
,
612 [inout
] sequence
< float > aSeqFloat
,
613 [inout
] sequence
< double > aSeqDouble
,
614 [inout
] sequence
< TestEnum
> aSeqEnum
,
615 [inout
] sequence
< string > aSeqString
,
616 [inout
] sequence
< com
::sun
::star
::uno
::XInterface
> aSeqXInterface
,
617 [inout
] sequence
< any
> aSeqAny
,
618 [inout
] sequence
< sequence
< long > > aSeqDim2
,
619 [inout
] sequence
< sequence
< sequence
< long > > > aSeqDim3
);
621 void setSequencesOut
( [out] sequence
< boolean > aSeqBoolean
,
622 [out] sequence
< char > aSeqChar
,
623 [out] sequence
< byte > aSeqByte
,
624 [out] sequence
< short > aSeqShort
,
625 [out] sequence
< unsigned short> aSeqUShort
,
626 [out] sequence
< long > aSeqLong
,
627 [out] sequence
< unsigned long > aSeqULong
,
628 [out] sequence
< hyper > aSeqHyper
,
629 [out] sequence
< unsigned hyper > aSeqUHyper
,
630 [out] sequence
< float > aSeqFloat
,
631 [out] sequence
< double > aSeqDouble
,
632 [out] sequence
< TestEnum
> aSeqEnum
,
633 [out] sequence
< string > aSeqString
,
634 [out] sequence
< com
::sun
::star
::uno
::XInterface
> aSeqXInterface
,
635 [out] sequence
< any
> aSeqAny
,
636 [out] sequence
< sequence
< long > > aSeqDim2
,
637 [out] sequence
< sequence
< sequence
< long > > > aSeqDim3
);
639 void testConstructorsService
(
640 [in] com
::sun
::star
::uno
::XComponentContext context
)
641 raises
(BadConstructorArguments
);
643 XCurrentContextChecker getCurrentContextChecker
();
648 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */