diff options
author | Oliver Bolte <obo@openoffice.org> | 2007-03-12 09:56:34 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2007-03-12 09:56:34 +0000 |
commit | 5ac7655804dda1f5f62d00bbbceef0d4c711bf85 (patch) | |
tree | dc81969d4c0d4c0d217156922b01170bf19b09f8 /stoc | |
parent | 97cae29530cb57f26911037535afdbb27a12c3c7 (diff) |
INTEGRATION: CWS sb36 (1.4.46); FILE MERGED
2006/11/08 16:54:28 sb 1.4.46.3: RESYNC: (1.5-1.7); FILE MERGED
2005/09/22 05:39:54 sb 1.4.46.2: RESYNC: (1.4-1.5); FILE MERGED
2005/07/14 12:38:21 sb 1.4.46.1: #i51803# Added support for vnd.sun.star.expand URLs.
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/test/uriproc/test_uriproc.cxx | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/stoc/test/uriproc/test_uriproc.cxx b/stoc/test/uriproc/test_uriproc.cxx index aff5a67de896..2ca17c17d83d 100644 --- a/stoc/test/uriproc/test_uriproc.cxx +++ b/stoc/test/uriproc/test_uriproc.cxx @@ -4,9 +4,9 @@ * * $RCSfile: test_uriproc.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: obo $ $Date: 2006-09-16 17:44:21 $ + * last change: $Author: obo $ $Date: 2007-03-12 10:56:34 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -47,8 +47,10 @@ #include "com/sun/star/uri/XExternalUriReferenceTranslator.hpp" #include "com/sun/star/uri/XUriReference.hpp" #include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include "com/sun/star/uri/XVndSunStarExpandUrlReference.hpp" #include "com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp" #include "com/sun/star/uri/XVndSunStarScriptUrlReference.hpp" +#include "com/sun/star/util/XMacroExpander.hpp" #include "cppuhelper/servicefactory.hxx" #include "cppunit/simpleheader.hxx" #include "osl/diagnose.h" @@ -130,6 +132,8 @@ public: void testMakeRelative(); + void testVndSunStarExpand(); + void testVndSunStarScript(); void testTranslator(); @@ -140,6 +144,7 @@ public: CPPUNIT_TEST(testParse); CPPUNIT_TEST(testMakeAbsolute); CPPUNIT_TEST(testMakeRelative); + CPPUNIT_TEST(testVndSunStarExpand); CPPUNIT_TEST(testVndSunStarScript); CPPUNIT_TEST(testTranslator); CPPUNIT_TEST(testPkgUrlFactory); @@ -746,6 +751,40 @@ void Test::testMakeRelative() { } } +void Test::testVndSunStarExpand() { + struct Data { + char const * uriReference; + char const * expanded; + }; + Data data[] = { + { "vnd.sun.star.expand:", "" }, // liberally accepted + { "vnd.sun.star.expand:/", "/" }, // liberally accepted + { "vnd.sun.star.expand:%80", 0 }, + { "vnd.sun.star.expand:%5C$%5C%24%5C%5C", "$$\\" } }; + css::uno::Reference< css::util::XMacroExpander > expander( + m_context->getValueByName( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/singletons/com.sun.star.util.theMacroExpander"))), + css::uno::UNO_QUERY_THROW); + for (std::size_t i = 0; i < sizeof data / sizeof data[0]; ++i) { + css::uno::Reference< css::uri::XUriReference > uriRef( + m_uriFactory->parse( + rtl::OUString::createFromAscii(data[i].uriReference))); + TEST_ASSERT_EQUAL( + "testVndSunStarExpand", i, data[i].uriReference, + data[i].expanded != 0, uriRef.is()); + if (uriRef.is()) { + css::uno::Reference< css::uri::XVndSunStarExpandUrlReference > + expandUrl(uriRef, css::uno::UNO_QUERY_THROW); + TEST_ASSERT_EQUAL( + "testVndSunStarExpand", i, data[i].uriReference, + rtl::OUString::createFromAscii(data[i].expanded), + expandUrl->expand(expander)); + } + } +} + void Test::testVndSunStarScript() { struct Parameter { char const * key; |