From 4b9c10e298a5285edbeb87c47303c151209abded Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Tue, 20 Nov 2012 22:19:51 +0100 Subject: fdo#57285 restore acceptsURL logic Change-Id: Ib03c7e4a78510eb0300d78a0ae3e83ec6a17f72f --- connectivity/qa/connectivity/mork/DriverTest.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'connectivity/qa') diff --git a/connectivity/qa/connectivity/mork/DriverTest.cxx b/connectivity/qa/connectivity/mork/DriverTest.cxx index 1db1d9f7c1e0..33720ac4b2d8 100644 --- a/connectivity/qa/connectivity/mork/DriverTest.cxx +++ b/connectivity/qa/connectivity/mork/DriverTest.cxx @@ -27,6 +27,7 @@ class MorkDriverTest: public test::BootstrapFixture public: MorkDriverTest() : test::BootstrapFixture(false, false) {}; + void checkAcceptsURL(Reference< XDriver> xDriver, const char* url, bool expected); void test_metadata(); void test_select_default_all(); void test_select_list_table_joe_doe_5(); @@ -46,6 +47,15 @@ private: Reference m_xConnection; }; +void MorkDriverTest::checkAcceptsURL(Reference< XDriver> xDriver, const char* url, bool expected) +{ + sal_Bool res = xDriver->acceptsURL(OUString::createFromAscii(url)); + if (res != expected) + { + CPPUNIT_ASSERT_MESSAGE("wrong URL outcome!", true); + } +} + void MorkDriverTest::setUp() { test::BootstrapFixture::setUp(); @@ -64,6 +74,18 @@ void MorkDriverTest::setUp() CPPUNIT_ASSERT_MESSAGE("cannot connect to mork driver!", xDriver.is()); } + // bad + checkAcceptsURL(xDriver, "sdbc:address:macab", false); + checkAcceptsURL(xDriver, "sdbc:mozab:ldap:", false); + checkAcceptsURL(xDriver, "sdbc:mozab:outlook:", false); + checkAcceptsURL(xDriver, "sdbc:mozab:outlookexp:", false); + + // good + checkAcceptsURL(xDriver, "sdbc:mozab:mozilla:", true); + checkAcceptsURL(xDriver, "sdbc:mozab:thunderbird:", true); + checkAcceptsURL(xDriver, "sdbc:address:mozilla:", true); + checkAcceptsURL(xDriver, "sdbc:address:thunderbird:", true); + m_xConnection = xDriver->connect(url, info); if (!m_xConnection.is()) { -- cgit v1.2.3