Kaydet (Commit) a1109855 authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_sw_unowriter: be consistent about using namespace declarations

This file already used uno::Reference at a number of places, then an
additional 'using namespace ::com::sun::star::uno;' makes little sense.
Especially that naked Reference may refer to rtl::Reference as well,
i.e. harder to read.

Change-Id: I8f0eda0e81a8da1af02a99ac37cb08496f753cf5
Reviewed-on: https://gerrit.libreoffice.org/69771
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 3149ffea
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <view.hxx> #include <view.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
namespace namespace
{ {
...@@ -210,7 +208,7 @@ DECLARE_UNOAPI_TEST(testGraphicDesciptorURLBitmap) ...@@ -210,7 +208,7 @@ DECLARE_UNOAPI_TEST(testGraphicDesciptorURLBitmap)
CPPUNIT_ASSERT(xGraphic.is()); CPPUNIT_ASSERT(xGraphic.is());
} }
static bool ensureAutoTextExistsByTitle(const Reference<XAutoTextGroup>& autoTextGroup, static bool ensureAutoTextExistsByTitle(const uno::Reference<text::XAutoTextGroup>& autoTextGroup,
const OUString& autoTextName) const OUString& autoTextName)
{ {
uno::Sequence<OUString> aTitles(autoTextGroup->getTitles()); uno::Sequence<OUString> aTitles(autoTextGroup->getTitles());
...@@ -222,7 +220,7 @@ static bool ensureAutoTextExistsByTitle(const Reference<XAutoTextGroup>& autoTex ...@@ -222,7 +220,7 @@ static bool ensureAutoTextExistsByTitle(const Reference<XAutoTextGroup>& autoTex
return false; return false;
} }
static bool ensureAutoTextExistsByName(const Reference<XAutoTextGroup>& autoTextGroup, static bool ensureAutoTextExistsByName(const uno::Reference<text::XAutoTextGroup>& autoTextGroup,
const OUString& autoTextName) const OUString& autoTextName)
{ {
uno::Sequence<OUString> aTitles(autoTextGroup->getElementNames()); uno::Sequence<OUString> aTitles(autoTextGroup->getElementNames());
...@@ -236,8 +234,8 @@ static bool ensureAutoTextExistsByName(const Reference<XAutoTextGroup>& autoText ...@@ -236,8 +234,8 @@ static bool ensureAutoTextExistsByName(const Reference<XAutoTextGroup>& autoText
DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt") DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt")
{ {
Reference<XAutoTextContainer> xAutoTextContainer uno::Reference<text::XAutoTextContainer> xAutoTextContainer
= AutoTextContainer::create(comphelper::getProcessComponentContext()); = text::AutoTextContainer::create(comphelper::getProcessComponentContext());
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1); uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
...@@ -248,12 +246,12 @@ DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt") ...@@ -248,12 +246,12 @@ DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt")
const OUString sTextTitleNew = "Test Auto Text Renamed"; const OUString sTextTitleNew = "Test Auto Text Renamed";
// Create new temporary group // Create new temporary group
Reference<XAutoTextGroup> xAutoTextGroup(xAutoTextContainer->insertNewByName(sGroupName), uno::Reference<text::XAutoTextGroup> xAutoTextGroup(
uno::UNO_QUERY); xAutoTextContainer->insertNewByName(sGroupName), uno::UNO_QUERY);
CPPUNIT_ASSERT_MESSAGE("AutoTextGroup was not found!", xAutoTextGroup.is()); CPPUNIT_ASSERT_MESSAGE("AutoTextGroup was not found!", xAutoTextGroup.is());
// Insert new element and ensure it exists // Insert new element and ensure it exists
Reference<XAutoTextEntry> xAutoTextEntry uno::Reference<text::XAutoTextEntry> xAutoTextEntry
= xAutoTextGroup->insertNewByName(sTextName, sTextTitle, xTextRange); = xAutoTextGroup->insertNewByName(sTextName, sTextTitle, xTextRange);
CPPUNIT_ASSERT_MESSAGE("AutoText was not inserted!", xAutoTextEntry.is()); CPPUNIT_ASSERT_MESSAGE("AutoText was not inserted!", xAutoTextEntry.is());
CPPUNIT_ASSERT_MESSAGE("Can't find newly created AutoText by title!", CPPUNIT_ASSERT_MESSAGE("Can't find newly created AutoText by title!",
...@@ -302,11 +300,11 @@ DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt") ...@@ -302,11 +300,11 @@ DECLARE_UNOAPI_TEST_FILE(testXAutoTextGroup, "xautotextgroup.odt")
DECLARE_UNOAPI_TEST(testXURI) DECLARE_UNOAPI_TEST(testXURI)
{ {
Reference<XComponentContext> xContext(::comphelper::getProcessComponentContext()); uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
// createKnown() // createKnown()
Reference<rdf::XURI> xURIcreateKnown(rdf::URI::createKnown(xContext, rdf::URIs::ODF_PREFIX), uno::Reference<rdf::XURI> xURIcreateKnown(
UNO_SET_THROW); rdf::URI::createKnown(xContext, rdf::URIs::ODF_PREFIX), uno::UNO_SET_THROW);
CPPUNIT_ASSERT(xURIcreateKnown.is()); CPPUNIT_ASSERT(xURIcreateKnown.is());
CPPUNIT_ASSERT_EQUAL(OUString("http://docs.oasis-open.org/ns/office/1.2/meta/odf#"), CPPUNIT_ASSERT_EQUAL(OUString("http://docs.oasis-open.org/ns/office/1.2/meta/odf#"),
xURIcreateKnown->getNamespace()); xURIcreateKnown->getNamespace());
...@@ -320,21 +318,22 @@ DECLARE_UNOAPI_TEST(testXURI) ...@@ -320,21 +318,22 @@ DECLARE_UNOAPI_TEST(testXURI)
lang::IllegalArgumentException); lang::IllegalArgumentException);
// create() // create()
Reference<rdf::XURI> xURIcreate(rdf::URI::create(xContext, "http://example.com/url#somedata"), uno::Reference<rdf::XURI> xURIcreate(
UNO_SET_THROW); rdf::URI::create(xContext, "http://example.com/url#somedata"), uno::UNO_SET_THROW);
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#"), xURIcreate->getNamespace()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#"), xURIcreate->getNamespace());
CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreate->getLocalName()); CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreate->getLocalName());
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#somedata"), xURIcreate->getStringValue()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#somedata"), xURIcreate->getStringValue());
// create() without local name splitted with "/" // create() without local name splitted with "/"
Reference<rdf::XURI> xURIcreate2(rdf::URI::create(xContext, "http://example.com/url"), uno::Reference<rdf::XURI> xURIcreate2(rdf::URI::create(xContext, "http://example.com/url"),
UNO_SET_THROW); uno::UNO_SET_THROW);
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), xURIcreate2->getNamespace()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), xURIcreate2->getNamespace());
CPPUNIT_ASSERT_EQUAL(OUString("url"), xURIcreate2->getLocalName()); CPPUNIT_ASSERT_EQUAL(OUString("url"), xURIcreate2->getLocalName());
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url"), xURIcreate2->getStringValue()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url"), xURIcreate2->getStringValue());
// create() without prefix // create() without prefix
Reference<rdf::XURI> xURIcreate3(rdf::URI::create(xContext, "#somedata"), UNO_SET_THROW); uno::Reference<rdf::XURI> xURIcreate3(rdf::URI::create(xContext, "#somedata"),
uno::UNO_SET_THROW);
CPPUNIT_ASSERT_EQUAL(OUString("#"), xURIcreate3->getNamespace()); CPPUNIT_ASSERT_EQUAL(OUString("#"), xURIcreate3->getNamespace());
CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreate3->getLocalName()); CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreate3->getLocalName());
CPPUNIT_ASSERT_EQUAL(OUString("#somedata"), xURIcreate3->getStringValue()); CPPUNIT_ASSERT_EQUAL(OUString("#somedata"), xURIcreate3->getStringValue());
...@@ -345,16 +344,16 @@ DECLARE_UNOAPI_TEST(testXURI) ...@@ -345,16 +344,16 @@ DECLARE_UNOAPI_TEST(testXURI)
lang::IllegalArgumentException); lang::IllegalArgumentException);
// createNS() // createNS()
Reference<rdf::XURI> xURIcreateNS( uno::Reference<rdf::XURI> xURIcreateNS(
rdf::URI::createNS(xContext, "http://example.com/url#", "somedata"), UNO_SET_THROW); rdf::URI::createNS(xContext, "http://example.com/url#", "somedata"), uno::UNO_SET_THROW);
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#"), xURIcreateNS->getNamespace()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#"), xURIcreateNS->getNamespace());
CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreateNS->getLocalName()); CPPUNIT_ASSERT_EQUAL(OUString("somedata"), xURIcreateNS->getLocalName());
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#somedata"), CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/url#somedata"),
xURIcreateNS->getStringValue()); xURIcreateNS->getStringValue());
// TODO: What's going on here? Is such usecase valid? // TODO: What's going on here? Is such usecase valid?
Reference<rdf::XURI> xURIcreateNS2( uno::Reference<rdf::XURI> xURIcreateNS2(
rdf::URI::createNS(xContext, "http://example.com/url", "somedata"), UNO_SET_THROW); rdf::URI::createNS(xContext, "http://example.com/url", "somedata"), uno::UNO_SET_THROW);
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), xURIcreateNS2->getNamespace()); CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/"), xURIcreateNS2->getNamespace());
CPPUNIT_ASSERT_EQUAL(OUString("urlsomedata"), xURIcreateNS2->getLocalName()); CPPUNIT_ASSERT_EQUAL(OUString("urlsomedata"), xURIcreateNS2->getLocalName());
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/urlsomedata"), CPPUNIT_ASSERT_EQUAL(OUString("http://example.com/urlsomedata"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment