summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-11-23 12:17:18 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-11-23 14:16:28 +0100
commit792cd487831b1f731b6fb2fc2d0f39ef60a63534 (patch)
treebe8ed694f3bfa2beb618ba4b925dbedd13025ca5 /tools
parentec1c4c49301758c54394f9943252e192ad54638b (diff)
Add test for INetURLObject::changeScheme
Change-Id: I84497ee93e30b639199bbbb958ac1b2c758db50c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125693 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 255c07137b1c..be605d53d6df 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -294,6 +294,23 @@ namespace tools_urlobj
obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
}
+ void testChangeScheme() {
+ INetURLObject obj("unkonwn://example.com/foo/bar");
+ CPPUNIT_ASSERT(!obj.HasError());
+ obj.changeScheme(INetProtocol::Http);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("http://example.com/foo/bar"),
+ obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ obj.changeScheme(INetProtocol::Https);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("https://example.com/foo/bar"),
+ obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ obj.changeScheme(INetProtocol::Ftp);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("ftp://example.com/foo/bar"),
+ obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+ }
+
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
@@ -308,6 +325,7 @@ namespace tools_urlobj
CPPUNIT_TEST( urlobjTest_isAnyKnownWebDAVScheme );
CPPUNIT_TEST( testSetName );
CPPUNIT_TEST( testSetExtension );
+ CPPUNIT_TEST( testChangeScheme );
CPPUNIT_TEST_SUITE_END( );
}; // class createPool