1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test_uriproc.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_stoc.hxx"
34 #include "com/sun/star/beans/XPropertySet.hpp"
35 #include "com/sun/star/lang/XComponent.hpp"
36 #include "com/sun/star/lang/XMultiComponentFactory.hpp"
37 #include "com/sun/star/uno/Reference.hxx"
38 #include "com/sun/star/uno/XComponentContext.hpp"
39 #include "com/sun/star/uri/ExternalUriReferenceTranslator.hpp"
40 #include "com/sun/star/uri/UriReferenceFactory.hpp"
41 #include "com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp"
42 #include "com/sun/star/uri/XExternalUriReferenceTranslator.hpp"
43 #include "com/sun/star/uri/XUriReference.hpp"
44 #include "com/sun/star/uri/XUriReferenceFactory.hpp"
45 #include "com/sun/star/uri/XVndSunStarExpandUrlReference.hpp"
46 #include "com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp"
47 #include "com/sun/star/uri/XVndSunStarScriptUrlReference.hpp"
48 #include "com/sun/star/util/XMacroExpander.hpp"
49 #include "cppuhelper/servicefactory.hxx"
50 #include "cppunit/simpleheader.hxx"
51 #include "osl/diagnose.h"
52 #include "osl/thread.h"
53 #include "rtl/string.h"
54 #include "rtl/string.hxx"
55 #include "rtl/textenc.h"
56 #include "rtl/ustrbuf.hxx"
57 #include "rtl/ustring.hxx"
58 #include "sal/types.h"
62 namespace css
= com::sun::star
;
66 #define TEST_ASSERT_EQUAL(token1, token2, token3, expected, actual) \
67 CPPUNIT_ASSERT_MESSAGE( \
68 createTestAssertEqualMessage( \
69 token1, token2, token3, #expected, #actual, expected, actual). \
71 (actual) == (expected))
73 template< typename T
> void append(
74 rtl::OUStringBuffer
& buffer
, T
const & value
)
79 template<> void append(rtl::OUStringBuffer
& buffer
, bool const & value
) {
80 buffer
.append(static_cast< sal_Bool
>(value
));
83 template<> void append(rtl::OUStringBuffer
& buffer
, std::size_t const & value
)
85 buffer
.append(static_cast< sal_Int32
>(value
));
88 template<> void append(rtl::OUStringBuffer
& buffer
, char const * const & value
)
90 buffer
.appendAscii(value
);
93 template< typename T1
, typename T2
, typename T3
, typename T4
>
94 rtl::OString
createTestAssertEqualMessage(
95 char const * token1
, T1
const & token2
, T2
const & token3
,
96 char const * expectedExpr
, char const * actualExpr
, T3
const & expected
,
99 rtl::OUStringBuffer buf
;
100 buf
.appendAscii(token1
);
101 buf
.append(static_cast< sal_Unicode
>('|'));
103 buf
.append(static_cast< sal_Unicode
>('|'));
105 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM(": TEST_ASSERT_EQUAL("));
106 buf
.appendAscii(expectedExpr
);
107 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
108 buf
.appendAscii(actualExpr
);
109 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM("): <"));
110 append(buf
, expected
);
111 buf
.appendAscii(RTL_CONSTASCII_STRINGPARAM("> != <"));
113 buf
.append(static_cast< sal_Unicode
>('>'));
114 return rtl::OUStringToOString(
115 buf
.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US
);
118 class Test
: public CppUnit::TestFixture
{
120 virtual void setUp();
122 virtual void tearDown();
126 void testMakeAbsolute();
128 void testMakeRelative();
130 void testVndSunStarExpand();
132 void testVndSunStarScript();
134 void testTranslator();
136 void testPkgUrlFactory();
138 CPPUNIT_TEST_SUITE(Test
);
139 CPPUNIT_TEST(testParse
);
140 CPPUNIT_TEST(testMakeAbsolute
);
141 CPPUNIT_TEST(testMakeRelative
);
142 CPPUNIT_TEST(testVndSunStarExpand
);
143 CPPUNIT_TEST(testVndSunStarScript
);
144 CPPUNIT_TEST(testTranslator
);
145 CPPUNIT_TEST(testPkgUrlFactory
);
146 CPPUNIT_TEST_SUITE_END();
149 css::uno::Reference
< css::uno::XComponentContext
> m_context
;
150 css::uno::Reference
< css::uri::XUriReferenceFactory
> m_uriFactory
;
154 char const * registry
= getForwardString();
155 css::uno::Reference
< css::lang::XMultiServiceFactory
> factory(
156 cppu::createRegistryServiceFactory(
158 registry
, rtl_str_getLength(registry
),
159 osl_getThreadTextEncoding())));
160 //TODO: check for string conversion failure
161 css::uno::Reference
< css::beans::XPropertySet
>(
162 factory
, css::uno::UNO_QUERY_THROW
)->getPropertyValue(
163 rtl::OUString::createFromAscii("DefaultContext")) >>= m_context
;
164 m_uriFactory
= css::uri::UriReferenceFactory::create(m_context
);
167 void Test::tearDown() {
168 css::uno::Reference
< css::lang::XComponent
>(
169 m_context
, css::uno::UNO_QUERY_THROW
)->dispose();
172 void Test::testParse() {
174 char const * uriReference
;
176 char const * schemeSpecificPart
;
178 char const * authority
;
180 bool hasRelativePath
;
181 sal_Int32 pathSegmentCount
;
182 char const * pathSegment0
;
183 char const * pathSegment1
;
184 char const * pathSegment2
;
185 char const * pathSegment3
;
186 char const * pathSegment4
;
188 char const * fragment
;
191 { "", 0, "", true, 0,
192 "", true, 0, "", "", "", "", "", 0, 0 },
193 { "scheme:", 0, 0, false, 0,
194 0, false, 0, 0, 0, 0, 0, 0, 0, 0 },
195 { "scheme:/", "scheme", "/", true, 0,
196 "/", false, 1, "", "", "", "", "", 0, 0 },
197 { "scheme://", "scheme", "//", true, "",
198 "", false, 0, "", "", "", "", "", 0, 0 },
199 { "scheme:///", "scheme", "///", true, "",
200 "/", false, 1, "", "", "", "", "", 0, 0 },
201 { "scheme:////", "scheme", "////", true, "",
202 "//", false, 2, "", "", "", "", "", 0, 0 },
203 { "scheme:////", "scheme", "////", true, "",
204 "//", false, 2, "", "", "", "", "", 0, 0 },
205 { "scheme:#", 0, 0, false, 0,
206 0, false, 0, 0, 0, 0, 0, 0, 0, 0 },
207 { "scheme:?", "scheme", "?", false, 0,
208 "?", false, 0, "", "", "", "", "", 0, 0 },
209 { "/", 0, "/", true, 0,
210 "/", false, 1, "", "", "", "", "", 0, 0 },
211 { "//", 0, "//", true, "",
212 "", false, 0, "", "", "", "", "", 0, 0 },
213 { "///", 0, "///", true, "",
214 "/", false, 1, "", "", "", "", "", 0, 0 },
215 { "////", 0, "////", true, "",
216 "//", false, 2, "", "", "", "", "", 0, 0 } };
217 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
218 css::uno::Reference
< css::uri::XUriReference
> uriRef(
220 rtl::OUString::createFromAscii(data
[i
].uriReference
)));
221 CPPUNIT_ASSERT(uriRef
.is() == (data
[i
].schemeSpecificPart
!= 0));
224 "testParse", i
, data
[i
].uriReference
,
225 rtl::OUString::createFromAscii(data
[i
].uriReference
),
226 uriRef
->getUriReference());
228 "testParse", i
, data
[i
].uriReference
,
229 data
[i
].scheme
!= 0, uriRef
->isAbsolute());
231 "testParse", i
, data
[i
].uriReference
,
232 rtl::OUString::createFromAscii(
233 data
[i
].scheme
== 0 ? "" : data
[i
].scheme
),
234 uriRef
->getScheme());
236 "testParse", i
, data
[i
].uriReference
,
237 rtl::OUString::createFromAscii(data
[i
].schemeSpecificPart
),
238 uriRef
->getSchemeSpecificPart());
240 "testParse", i
, data
[i
].uriReference
,
241 data
[i
].isHierarchical
,
242 static_cast< bool >(uriRef
->isHierarchical()));
244 "testParse", i
, data
[i
].uriReference
,
245 data
[i
].authority
!= 0, uriRef
->hasAuthority());
247 "testParse", i
, data
[i
].uriReference
,
248 rtl::OUString::createFromAscii(
249 data
[i
].authority
== 0 ? "" : data
[i
].authority
),
250 uriRef
->getAuthority());
252 "testParse", i
, data
[i
].uriReference
,
253 rtl::OUString::createFromAscii(data
[i
].path
),
256 "testParse", i
, data
[i
].uriReference
,
257 data
[i
].hasRelativePath
,
258 static_cast< bool >(uriRef
->hasRelativePath()));
260 "testParse", i
, data
[i
].uriReference
,
261 data
[i
].pathSegmentCount
, uriRef
->getPathSegmentCount());
263 "testParse", i
, data
[i
].uriReference
,
264 rtl::OUString::createFromAscii(""), uriRef
->getPathSegment(-1));
266 "testParse", i
, data
[i
].uriReference
,
267 rtl::OUString::createFromAscii(data
[i
].pathSegment0
),
268 uriRef
->getPathSegment(0));
270 "testParse", i
, data
[i
].uriReference
,
271 rtl::OUString::createFromAscii(data
[i
].pathSegment1
),
272 uriRef
->getPathSegment(1));
274 "testParse", i
, data
[i
].uriReference
,
275 rtl::OUString::createFromAscii(data
[i
].pathSegment2
),
276 uriRef
->getPathSegment(2));
278 "testParse", i
, data
[i
].uriReference
,
279 rtl::OUString::createFromAscii(data
[i
].pathSegment3
),
280 uriRef
->getPathSegment(3));
282 "testParse", i
, data
[i
].uriReference
,
283 rtl::OUString::createFromAscii(data
[i
].pathSegment4
),
284 uriRef
->getPathSegment(4));
286 "testParse", i
, data
[i
].uriReference
,
287 rtl::OUString::createFromAscii(""), uriRef
->getPathSegment(5));
289 "testParse", i
, data
[i
].uriReference
,
290 data
[i
].query
!= 0, uriRef
->hasQuery());
292 "testParse", i
, data
[i
].uriReference
,
293 rtl::OUString::createFromAscii(
294 data
[i
].query
== 0 ? "" : data
[i
].query
),
297 "testParse", i
, data
[i
].uriReference
,
298 data
[i
].fragment
!= 0, uriRef
->hasFragment());
300 "testParse", i
, data
[i
].uriReference
,
301 rtl::OUString::createFromAscii(
302 data
[i
].fragment
== 0 ? "" : data
[i
].fragment
),
303 uriRef
->getFragment());
308 void Test::testMakeAbsolute() {
310 char const * baseUriReference
;
311 char const * uriReference
;
312 bool processSpecialBaseSegments
;
313 css::uri::RelativeUriExcessParentSegments excessParentSegments
;
314 char const * absolute
;
317 // The following tests are taken from RFC 2396, Appendix C:
318 { "http://a/b/c/d;p?q", "g:h", true,
319 css::uri::RelativeUriExcessParentSegments_ERROR
, "g:h" },
320 { "http://a/b/c/d;p?q", "g", true,
321 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/g" },
322 { "http://a/b/c/d;p?q", "./g", true,
323 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/g" },
324 { "http://a/b/c/d;p?q", "g/", true,
325 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/g/" },
326 { "http://a/b/c/d;p?q", "//g", true,
327 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://g" },
328 { "http://a/b/c/d;p?q", "?y", true,
329 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/?y" },
330 { "http://a/b/c/d;p?q", "g?y", true,
331 css::uri::RelativeUriExcessParentSegments_ERROR
,
332 "http://a/b/c/g?y" },
333 { "http://a/b/c/d;p?q", "#s", true,
334 css::uri::RelativeUriExcessParentSegments_ERROR
,
335 "http://a/b/c/d;p?q#s" },
336 { "http://a/b/c/d;p?q", "g#s", true,
337 css::uri::RelativeUriExcessParentSegments_ERROR
,
338 "http://a/b/c/g#s" },
339 { "http://a/b/c/d;p?q", "g?y#s", true,
340 css::uri::RelativeUriExcessParentSegments_ERROR
,
341 "http://a/b/c/g?y#s" },
342 { "http://a/b/c/d;p?q", ";x", true,
343 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/;x" },
344 { "http://a/b/c/d;p?q", "g;x", true,
345 css::uri::RelativeUriExcessParentSegments_ERROR
,
346 "http://a/b/c/g;x" },
347 { "http://a/b/c/d;p?q", "g;x?y#s", true,
348 css::uri::RelativeUriExcessParentSegments_ERROR
,
349 "http://a/b/c/g;x?y#s" },
350 { "http://a/b/c/d;p?q", ".", true,
351 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/" },
352 { "http://a/b/c/d;p?q", "./", true,
353 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/" },
354 { "http://a/b/c/d;p?q", "..", true,
355 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/" },
356 { "http://a/b/c/d;p?q", "../", true,
357 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/" },
358 { "http://a/b/c/d;p?q", "../g", true,
359 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/g" },
360 { "http://a/b/c/d;p?q", "../..", true,
361 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/" },
362 { "http://a/b/c/d;p?q", "../../", true,
363 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/" },
364 { "http://a/b/c/d;p?q", "../../g", true,
365 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/g" },
366 { "http://a/b/c/d;p?q", "", true,
367 css::uri::RelativeUriExcessParentSegments_ERROR
,
368 "http://a/b/c/d;p?q" },
369 { "http://a/b/c/d;p?q", "../../../g", true,
370 css::uri::RelativeUriExcessParentSegments_ERROR
, 0 },
371 { "http://a/b/c/d;p?q", "../../../g", true,
372 css::uri::RelativeUriExcessParentSegments_RETAIN
, "http://a/../g" },
373 { "http://a/b/c/d;p?q", "../../../g", true,
374 css::uri::RelativeUriExcessParentSegments_REMOVE
, "http://a/g" },
375 { "http://a/b/c/d;p?q", "../../../../g", true,
376 css::uri::RelativeUriExcessParentSegments_ERROR
, 0 },
377 { "http://a/b/c/d;p?q", "../../../../g", true,
378 css::uri::RelativeUriExcessParentSegments_RETAIN
,
379 "http://a/../../g" },
380 { "http://a/b/c/d;p?q", "../../../../g", true,
381 css::uri::RelativeUriExcessParentSegments_REMOVE
, "http://a/g" },
382 { "http://a/b/c/d;p?q", "/./g", true,
383 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/./g" },
384 { "http://a/b/c/d;p?q", "/../g", true,
385 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/../g" },
386 { "http://a/b/c/d;p?q", "g.", true,
387 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/g." },
388 { "http://a/b/c/d;p?q", ".g", true,
389 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/.g" },
390 { "http://a/b/c/d;p?q", "g..", true,
391 css::uri::RelativeUriExcessParentSegments_ERROR
,
392 "http://a/b/c/g.." },
393 { "http://a/b/c/d;p?q", "..g", true,
394 css::uri::RelativeUriExcessParentSegments_ERROR
,
395 "http://a/b/c/..g" },
396 { "http://a/b/c/d;p?q", "./../g", true,
397 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/g" },
398 { "http://a/b/c/d;p?q", "./g/.", true,
399 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/g/" },
400 { "http://a/b/c/d;p?q", "g/./h", true,
401 css::uri::RelativeUriExcessParentSegments_ERROR
,
402 "http://a/b/c/g/h" },
403 { "http://a/b/c/d;p?q", "g/../h", true,
404 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/h" },
405 { "http://a/b/c/d;p?q", "g;x=1/./y", true,
406 css::uri::RelativeUriExcessParentSegments_ERROR
,
407 "http://a/b/c/g;x=1/y" },
408 { "http://a/b/c/d;p?q", "g;x=1/../y", true,
409 css::uri::RelativeUriExcessParentSegments_ERROR
, "http://a/b/c/y" },
410 { "http://a/b/c/d;p?q", "g?y/./x", true,
411 css::uri::RelativeUriExcessParentSegments_ERROR
,
412 "http://a/b/c/g?y/./x" },
413 { "http://a/b/c/d;p?q", "g?y/../x", true,
414 css::uri::RelativeUriExcessParentSegments_ERROR
,
415 "http://a/b/c/g?y/../x" },
416 { "http://a/b/c/d;p?q", "g#s/./x", true,
417 css::uri::RelativeUriExcessParentSegments_ERROR
,
418 "http://a/b/c/g#s/./x" },
419 { "http://a/b/c/d;p?q", "g#s/../x", true,
420 css::uri::RelativeUriExcessParentSegments_ERROR
,
421 "http://a/b/c/g#s/../x" },
422 { "http.://a/b/c/d;p?q", "http.:g", true,
423 css::uri::RelativeUriExcessParentSegments_ERROR
, "http.:g" },
425 { "scheme://a", "", true,
426 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
427 { "scheme://a", ".", true,
428 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
429 { "scheme://a", "./", true,
430 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
431 { "scheme://a", "./.", true,
432 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
433 { "scheme://a", "././", true,
434 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
435 { "scheme://a", "././.", true,
436 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
437 { "scheme://a", "x/..", true,
438 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
439 { "scheme://a", "x/../", true,
440 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
441 { "scheme://a", "x/../.", true,
442 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
443 { "scheme://a", "x/.././", true,
444 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
445 { "scheme://a", "x/.././.", true,
446 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
447 { "scheme://a", "x/../././", true,
448 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
449 { "scheme://a", "x/../././.", true,
450 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
451 { "scheme://a", "./x/..", true,
452 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
453 { "scheme://a", "././x/..", true,
454 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
455 { "scheme://a", "./././x/..", true,
456 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
457 { "scheme://a", "./x/../.", true,
458 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
459 { "scheme://a", "./x/.././", true,
460 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
461 { "scheme://a", "././x/.././.", true,
462 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
463 { "scheme://a", "././x/../././", true,
464 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
465 { "scheme://a", "./././x/../././.", true,
466 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
468 { "scheme://a/", "", true,
469 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
470 { "scheme://a/", ".", true,
471 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
472 { "scheme://a/", "./", true,
473 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
474 { "scheme://a/", "./.", true,
475 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
476 { "scheme://a/", "././", true,
477 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
478 { "scheme://a/", "././.", true,
479 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
480 { "scheme://a/", "x/..", true,
481 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
482 { "scheme://a/", "x/../", true,
483 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
484 { "scheme://a/", "x/../.", true,
485 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
486 { "scheme://a/", "x/.././", true,
487 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
488 { "scheme://a/", "x/.././.", true,
489 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
490 { "scheme://a/", "x/../././", true,
491 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
492 { "scheme://a/", "x/../././.", true,
493 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
494 { "scheme://a/", "./x/..", true,
495 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
496 { "scheme://a/", "././x/..", true,
497 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
498 { "scheme://a/", "./././x/..", true,
499 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
500 { "scheme://a/", "./x/../.", true,
501 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
502 { "scheme://a/", "./x/.././", true,
503 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
504 { "scheme://a/", "././x/.././.", true,
505 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
506 { "scheme://a/", "././x/../././", true,
507 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
508 { "scheme://a/", "./././x/../././.", true,
509 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
511 { "scheme://a/b", "", true,
512 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b" },
513 { "scheme://a/b", ".", true,
514 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
515 { "scheme://a/b", "./", true,
516 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
517 { "scheme://a/b", "./.", true,
518 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
519 { "scheme://a/b", "././", true,
520 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
521 { "scheme://a/b", "././.", true,
522 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
523 { "scheme://a/b", "x/..", true,
524 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
525 { "scheme://a/b", "x/../", true,
526 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
527 { "scheme://a/b", "x/../.", true,
528 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
529 { "scheme://a/b", "x/.././", true,
530 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
531 { "scheme://a/b", "x/.././.", true,
532 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
533 { "scheme://a/b", "x/../././", true,
534 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
535 { "scheme://a/b", "x/../././.", true,
536 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
537 { "scheme://a/b", "./x/..", true,
538 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
539 { "scheme://a/b", "././x/..", true,
540 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
541 { "scheme://a/b", "./././x/..", true,
542 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
543 { "scheme://a/b", "./x/../.", true,
544 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
545 { "scheme://a/b", "./x/.././", true,
546 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
547 { "scheme://a/b", "././x/.././.", true,
548 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
549 { "scheme://a/b", "././x/../././", true,
550 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
551 { "scheme://a/b", "./././x/../././.", true,
552 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/" },
554 { "scheme://a/b/", "", true,
555 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
556 { "scheme://a/b/", ".", true,
557 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
558 { "scheme://a/b/", "./", true,
559 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
560 { "scheme://a/b/", "./.", true,
561 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
562 { "scheme://a/b/", "././", true,
563 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
564 { "scheme://a/b/", "././.", true,
565 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
566 { "scheme://a/b/", "x/..", true,
567 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
568 { "scheme://a/b/", "x/../", true,
569 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
570 { "scheme://a/b/", "x/../.", true,
571 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
572 { "scheme://a/b/", "x/.././", true,
573 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
574 { "scheme://a/b/", "x/.././.", true,
575 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
576 { "scheme://a/b/", "x/../././", true,
577 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
578 { "scheme://a/b/", "x/../././.", true,
579 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
580 { "scheme://a/b/", "./x/..", true,
581 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
582 { "scheme://a/b/", "././x/..", true,
583 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
584 { "scheme://a/b/", "./././x/..", true,
585 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
586 { "scheme://a/b/", "./x/../.", true,
587 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
588 { "scheme://a/b/", "./x/.././", true,
589 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
590 { "scheme://a/b/", "././x/.././.", true,
591 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
592 { "scheme://a/b/", "././x/../././", true,
593 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
594 { "scheme://a/b/", "./././x/../././.", true,
595 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a/b/" },
597 { "scheme://a#s", "", true,
598 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a" },
599 { "scheme://a", "?q", true,
600 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a?q" },
601 { "scheme://a#s", "?q", true,
602 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a?q" },
603 { "scheme://a", "#s", true,
604 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a#s" },
605 { "scheme://a#s1", "#s2", true,
606 css::uri::RelativeUriExcessParentSegments_ERROR
, "scheme://a#s2" } };
607 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
608 css::uno::Reference
< css::uri::XUriReference
> baseUriRef(
610 rtl::OUString::createFromAscii(data
[i
].baseUriReference
)));
611 CPPUNIT_ASSERT(baseUriRef
.is());
612 css::uno::Reference
< css::uri::XUriReference
> uriRef(
614 rtl::OUString::createFromAscii(data
[i
].uriReference
)));
615 CPPUNIT_ASSERT(uriRef
.is());
616 css::uno::Reference
< css::uri::XUriReference
> absolute(
617 m_uriFactory
->makeAbsolute(
618 baseUriRef
, uriRef
, data
[i
].processSpecialBaseSegments
,
619 data
[i
].excessParentSegments
));
621 "testMakeAbsolute", i
, data
[i
].uriReference
,
622 data
[i
].absolute
!= 0, absolute
.is());
625 "testMakeAbsolute", i
, data
[i
].uriReference
,
626 rtl::OUString::createFromAscii(data
[i
].absolute
),
627 absolute
->getUriReference());
632 void Test::testMakeRelative() {
634 char const * baseUriReference
;
635 char const * uriReference
;
636 bool preferAuthorityOverRelativePath
;
637 bool preferAbsoluteOverRelativePath
;
638 bool encodeRetainedSpecialSegments
;
639 char const * relative
;
640 char const * absolute
;
643 { "scheme1://a/b/c", "scheme2://a/b/c?q#s", true, true, false,
644 "scheme2://a/b/c?q#s", 0 },
645 { "scheme://a/b/c", "scheme:a/b/c?q#s", true, true, false,
646 "scheme:a/b/c?q#s", 0 },
647 { "scheme://a/b/c", "", true, true, false, "", "scheme://a/b/c" },
648 { "scheme://a/b/c", "//d/e/f", true, true, false, "//d/e/f",
650 { "scheme://a/b/c", "./e?q#s", true, true, false, "./e?q#s",
651 "scheme://a/b/e?q#s" },
652 { "scheme://a/b", "scheme://a?q", true, true, false, "/?q",
654 { "scheme://a/b", "scheme://a?q", true, false, false, "?q",
656 { "scheme://a", "scheme://a?q", true, true, false, "?q", 0 },
657 { "scheme://a/", "scheme://a?q", true, true, false, "?q",
659 { "scheme://a", "scheme://a/?q", true, true, false, "?q",
661 { "scheme://a/", "scheme://a/?q", true, true, false, "?q",
663 { "scheme://a?q", "scheme://a?q", true, true, false, "", 0 },
664 { "scheme://a/?q", "scheme://a?q", true, true, false, "",
666 { "scheme://a?q", "scheme://a/?q", true, true, false, "",
668 { "scheme://a/?q", "scheme://a/?q", true, true, false, "", 0 },
669 { "scheme://a/b/c/d", "scheme://a//", true, true, false, "//a//", 0 },
670 { "scheme://a/b/c/d", "scheme://a//", false, true, false, "../..//",
672 { "scheme://a/b/c/d", "scheme://a//", true, false, false, "../..//",
674 { "scheme://a/b/c/d", "scheme://a//", false, false, false, "../..//",
676 { "scheme://a/b/c/d", "scheme://a/e", true, true, false, "/e", 0 },
677 { "scheme://a/b/c/d", "scheme://a/e", true, false, false, "../../e",
679 { "scheme://a/b/c/d/e", "scheme://a/b/f", true, true, false, "../../f",
681 { "scheme://a/b/c/d/e", "scheme://a/b", true, true, false, "/b", 0 },
682 { "scheme://a/b/c/d/e", "scheme://a/b", true, false, false,
684 { "scheme://a/b/c/d/e", "scheme://a/b/", true, true, false, "../..",
686 { "scheme://a/b/c/d/e", "scheme://a/b/c", true, true, false, "../../c",
688 { "scheme://a/b/c/d/e", "scheme://a/b/c/", true, true, false, "..", 0 },
689 { "scheme://a/b/", "scheme://a/b/c/d", true, true, false, "c/d", 0 },
690 { "scheme://a/b/", "scheme://a/b/c/d/", true, true, false, "c/d/", 0 },
691 { "scheme://a/b/c", "scheme://a/b//", true, true, false, ".//", 0 },
692 { "scheme://a/b/c", "scheme://a/b//d", true, true, false, ".//d", 0 },
693 { "scheme://a/b/c", "scheme://a/b//d//", true, true, false, ".//d//",
695 { "scheme://a/b/c", "scheme://a/b/d+:", true, true, false, "./d+:", 0 },
696 { "scheme://a/b/c", "scheme://a/b/+d:", true, true, false, "+d:", 0 },
697 { "scheme://a/b/c", "scheme://a/b/d#e:f", true, true, false, "d#e:f",
699 { "scheme://a/b/c/", "scheme://a/b/../d/.e/.", true, true, false,
701 "scheme://a/d/.e/" },
702 { "scheme://a/b/c/", "scheme://a/b/../d/.e/.", true, true, true,
703 "../%2E%2E/d/.e/%2E", "scheme://a/b/%2E%2E/d/.e/%2E" },
704 { "scheme://auth/a/b", "scheme://auth//c/d", true, true, false,
706 { "scheme://auth/a/b", "scheme://auth//c/d", false, true, false,
708 { "scheme://auth/a/b", "scheme://auth/c/d", true, true, false, "/c/d",
710 { "scheme://auth/a/b", "scheme://auth/c/d", true, false, false,
712 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
713 css::uno::Reference
< css::uri::XUriReference
> baseUriRef(
715 rtl::OUString::createFromAscii(data
[i
].baseUriReference
)));
716 CPPUNIT_ASSERT(baseUriRef
.is());
717 css::uno::Reference
< css::uri::XUriReference
> uriRef(
719 rtl::OUString::createFromAscii(data
[i
].uriReference
)));
720 CPPUNIT_ASSERT(uriRef
.is());
721 css::uno::Reference
< css::uri::XUriReference
> relative(
722 m_uriFactory
->makeRelative(
723 baseUriRef
, uriRef
, data
[i
].preferAuthorityOverRelativePath
,
724 data
[i
].preferAbsoluteOverRelativePath
,
725 data
[i
].encodeRetainedSpecialSegments
));
727 "testMakeRelative", i
, data
[i
].uriReference
,
728 data
[i
].relative
!= 0, relative
.is());
731 "testMakeRelative", i
, data
[i
].uriReference
,
732 rtl::OUString::createFromAscii(data
[i
].relative
),
733 relative
->getUriReference());
734 css::uno::Reference
< css::uri::XUriReference
> absolute(
735 m_uriFactory
->makeAbsolute(
736 baseUriRef
, relative
, true,
737 css::uri::RelativeUriExcessParentSegments_ERROR
));
738 CPPUNIT_ASSERT(absolute
.is());
740 "testMakeRelative", i
, data
[i
].uriReference
,
741 rtl::OUString::createFromAscii(
742 data
[i
].absolute
== 0
743 ? data
[i
].uriReference
: data
[i
].absolute
),
744 absolute
->getUriReference());
749 void Test::testVndSunStarExpand() {
751 char const * uriReference
;
752 char const * expanded
;
755 { "vnd.sun.star.expand:", "" }, // liberally accepted
756 { "vnd.sun.star.expand:/", "/" }, // liberally accepted
757 { "vnd.sun.star.expand:%80", 0 },
758 { "vnd.sun.star.expand:%5C$%5C%24%5C%5C", "$$\\" } };
759 css::uno::Reference
< css::util::XMacroExpander
> expander(
760 m_context
->getValueByName(
762 RTL_CONSTASCII_USTRINGPARAM(
763 "/singletons/com.sun.star.util.theMacroExpander"))),
764 css::uno::UNO_QUERY_THROW
);
765 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
766 css::uno::Reference
< css::uri::XUriReference
> uriRef(
768 rtl::OUString::createFromAscii(data
[i
].uriReference
)));
770 "testVndSunStarExpand", i
, data
[i
].uriReference
,
771 data
[i
].expanded
!= 0, uriRef
.is());
773 css::uno::Reference
< css::uri::XVndSunStarExpandUrlReference
>
774 expandUrl(uriRef
, css::uno::UNO_QUERY_THROW
);
776 "testVndSunStarExpand", i
, data
[i
].uriReference
,
777 rtl::OUString::createFromAscii(data
[i
].expanded
),
778 expandUrl
->expand(expander
));
783 void Test::testVndSunStarScript() {
788 std::size_t const parameterCount
= 3;
790 char const * uriReference
;
792 const bool normalized
;
793 Parameter parameters
[parameterCount
];
796 { "vnd.sun.star.script:", 0, false, {} },
797 { "vnd.sun.star.script:/", 0, false, {} },
798 { "vnd.sun.star.script:/abc/def?ghi=jkl&mno=pqr", 0, false, {} },
799 { "vnd.sun.star.script:abc%3fdef/ghi", "abc?def/ghi", false, {} },
800 { "vnd.sun.star.script:name?a", 0, false, {} },
801 { "vnd.sun.star.script:name?a=", "name", true, { { "a", "" }, { "A", 0 } } },
802 { "vnd.sun.star.script:name?a=&", 0, true, {} },
803 { "vnd.sun.star.script:name?key1=&%26=%3D&key1=hello", "name", true,
804 { { "key1", "" }, { "key2", 0 }, { "&", "=" } } } };
805 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
806 css::uno::Reference
< css::uri::XUriReference
> uriRef(
808 rtl::OUString::createFromAscii(data
[i
].uriReference
)));
810 "testVndSunStarScript", i
, data
[i
].uriReference
, data
[i
].name
!= 0,
813 css::uno::Reference
< css::uri::XVndSunStarScriptUrlReference
>
814 scriptUrl(uriRef
, css::uno::UNO_QUERY_THROW
);
816 "testVndSunStarScript", i
, data
[i
].uriReference
,
817 rtl::OUString::createFromAscii(data
[i
].uriReference
),
818 scriptUrl
->getUriReference());
820 "testVndSunStarScript", i
, data
[i
].uriReference
,
821 rtl::OUString::createFromAscii(data
[i
].name
),
822 scriptUrl
->getName());
823 rtl::OUString
originalReference(uriRef
->getUriReference());
824 for (std::size_t j
= 0; j
< parameterCount
; ++j
) {
825 if (data
[i
].parameters
[j
].key
!= 0) {
827 "testVndSunStarScript",
828 static_cast< double >(i
)
829 + static_cast< double >(j
) / 10.0,
830 data
[i
].uriReference
,
831 data
[i
].parameters
[j
].value
!= 0,
832 scriptUrl
->hasParameter(
833 rtl::OUString::createFromAscii(
834 data
[i
].parameters
[j
].key
)));
836 "testVndSunStarScript",
837 static_cast< double >(i
)
838 + static_cast< double >(j
) / 10.0,
839 data
[i
].uriReference
,
840 rtl::OUString::createFromAscii(
841 data
[i
].parameters
[j
].value
),
842 scriptUrl
->getParameter(
843 rtl::OUString::createFromAscii(
844 data
[i
].parameters
[j
].key
)));
846 // setting the parameter to its original value should not change
847 // the overall uri reference (provided it was normalized before)
848 if ( data
[i
].normalized
) {
849 if ( scriptUrl
->hasParameter(rtl::OUString::createFromAscii(
850 data
[i
].parameters
[j
].key
)) ) {
851 scriptUrl
->setParameter(
852 rtl::OUString::createFromAscii(
853 data
[i
].parameters
[j
].key
),
854 scriptUrl
->getParameter(
855 rtl::OUString::createFromAscii(
856 data
[i
].parameters
[j
].key
)));
858 "testVndSunStarScript",
859 static_cast< double >(i
)
860 + static_cast< double >(j
) / 10.0,
861 ::rtl::OUString::createFromAscii("setParameter"),
863 uriRef
->getUriReference());
868 if ( data
[i
].normalized
) {
869 scriptUrl
->setName(scriptUrl
->getName());
871 "testVndSunStarScript",
873 ::rtl::OUString::createFromAscii("setName"),
875 uriRef
->getUriReference());
880 css::uno::Reference
< css::uri::XUriReference
> uriRef(
883 RTL_CONSTASCII_USTRINGPARAM(
884 "vnd.sun.star.script:Hello?location=Library.Module"))),
885 css::uno::UNO_SET_THROW
);
886 css::uno::Reference
< css::uri::XVndSunStarScriptUrlReference
>
887 scriptUrl(uriRef
, css::uno::UNO_QUERY_THROW
);
889 scriptUrl
->setParameter(
890 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "location")),
891 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "foo")));
893 "testVndSunStarScript", (sal_Int32
)10, (sal_Int32
)1,
894 uriRef
->getUriReference(),
895 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:Hello?location=foo")));
897 scriptUrl
->setParameter(
898 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "language")),
899 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "StarBasic")));
901 "testVndSunStarScript", (sal_Int32
)10, (sal_Int32
)2,
902 uriRef
->getUriReference(),
903 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:Hello?location=foo&language=StarBasic")));
906 bool caughtExpected
= false;
908 scriptUrl
->setName(::rtl::OUString());
910 catch( const css::lang::IllegalArgumentException
& ) {
911 caughtExpected
= true;
914 "testVndSunStarScript",
915 ::rtl::OUString::createFromAscii("illegal arguments"),
916 ::rtl::OUString::createFromAscii("name"),
920 caughtExpected
= false;
922 scriptUrl
->setParameter(
924 ::rtl::OUString::createFromAscii("non-empty"));
926 catch( const css::lang::IllegalArgumentException
& ) {
927 caughtExpected
= true;
930 "testVndSunStarScript",
931 ::rtl::OUString::createFromAscii("illegal arguments"),
932 ::rtl::OUString::createFromAscii("parameter"),
937 void Test::testTranslator() {
939 char const * externalUriReference
;
940 char const * internalUriReference
;
945 { "#fragment", "#fragment", true },
946 { "segment/segment?query#fragment", "segment/segment?query#fragment",
948 { "/segment/segment?query#fragment", "/segment/segment?query#fragment",
950 { "//authority/segment?query#fragment",
951 "//authority/segment?query#fragment", true },
952 { "foo:bar#fragment", "foo:bar#fragment", true },
953 { "file:///abc/def", "file:///abc/def", true },
954 { "file:///abc/%FEef", "file:///abc/%feef", false },
955 { "file:///abc/%80%80ef", "file:///abc/%80%80ef", false },
956 { "file:///abc/%ED%A0%80%ED%B0%80ef",
957 "file:///abc/%ED%A0%80%ED%B0%80ef", false },
958 { "file:///abc/%25.ef", "file:///abc/%.ef", false },
959 { "file:///abc/%25ef", "file:///abc/%25ef", true } };
960 css::uno::Reference
< css::uri::XExternalUriReferenceTranslator
>
961 translator(css::uri::ExternalUriReferenceTranslator::create(m_context
));
962 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
963 if (data
[i
].toInternal
) {
965 "testTranslator, translateToInternal", i
,
966 data
[i
].externalUriReference
,
967 rtl::OUString::createFromAscii(data
[i
].internalUriReference
),
968 translator
->translateToInternal(
969 rtl::OUString::createFromAscii(
970 data
[i
].externalUriReference
)));
973 "testTranslator, translateToExternal", i
,
974 data
[i
].internalUriReference
,
975 rtl::OUString::createFromAscii(data
[i
].externalUriReference
),
976 translator
->translateToExternal(
977 rtl::OUString::createFromAscii(data
[i
].internalUriReference
)));
981 void Test::testPkgUrlFactory() {
983 char const * authority
;
988 { "file:///#foo", 0 },
989 { "file:///a%25b%2fc/d~e&f@g?h",
990 "vnd.sun.star.pkg://file:%2F%2F%2Fa%2525b%252fc%2Fd~e&f@g%3Fh" } };
991 css::uno::Reference
< css::uri::XVndSunStarPkgUrlReferenceFactory
> factory(
992 css::uri::VndSunStarPkgUrlReferenceFactory::create(m_context
));
993 for (std::size_t i
= 0; i
< sizeof data
/ sizeof data
[0]; ++i
) {
994 css::uno::Reference
< css::uri::XUriReference
> url(
995 factory
->createVndSunStarPkgUrlReference(
997 rtl::OUString::createFromAscii(data
[i
].authority
))));
999 "testVndSunStarPkgFactory", i
, data
[i
].authority
,
1000 data
[i
].result
!= 0, static_cast< bool >(url
.is()));
1001 if (data
[i
].result
!= 0) {
1003 "testVndSunStarPkgFactory", i
, data
[i
].authority
,
1004 rtl::OUString::createFromAscii(data
[i
].result
),
1005 url
->getUriReference());
1010 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test
, "alltests");