diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2013-03-15 20:26:21 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-03-16 17:09:37 +0000 |
commit | fdb41140bf30bf18c05bbd0fd2c35594a9e6b338 (patch) | |
tree | 5cd066997a85d17cf6b839271447a409538a7d08 /tools | |
parent | Updated core (diff) | |
download | core-fdb41140bf30bf18c05bbd0fd2c35594a9e6b338.tar.gz core-fdb41140bf30bf18c05bbd0fd2c35594a9e6b338.zip |
Remove STRINGPARAM in tools (qa)
Change-Id: I1bff00d261c24e37f9ed41322c49c670850a940f
Reviewed-on: https://gerrit.libreoffice.org/2768
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_stream.cxx | 38 | ||||
-rw-r--r-- | tools/qa/cppunit/test_urlobj.cxx | 27 |
2 files changed, 28 insertions, 37 deletions
diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index b0aeb030bb47..894ad7d3e030 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -61,7 +61,7 @@ namespace { char foo[] = "foo"; std::istringstream iss(foo, std::istringstream::in); - SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); + SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ); char std_a(78); iss >> std_a; @@ -152,13 +152,13 @@ namespace void Test::test_fastostring() { char foo[] = "foobar"; - SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); + SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ); rtl::OString aOne = read_uInt8s_ToOString(aMemStream, 3); - CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); + CPPUNIT_ASSERT(aOne == "foo"); rtl::OString aTwo = read_uInt8s_ToOString(aMemStream, 3); - CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar"))); + CPPUNIT_ASSERT(aTwo == "bar"); rtl::OString aThree = read_uInt8s_ToOString(aMemStream, 3); CPPUNIT_ASSERT(aThree.isEmpty()); @@ -166,16 +166,16 @@ namespace aMemStream.Seek(0); rtl::OString aFour = read_uInt8s_ToOString(aMemStream, 100); - CPPUNIT_ASSERT(aFour.equalsL(RTL_CONSTASCII_STRINGPARAM(foo))); + CPPUNIT_ASSERT(aFour == foo); } void Test::test_read_cstring() { char foo[] = "foobar"; - SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); + SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ); rtl::OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar"))); + CPPUNIT_ASSERT(aOne == "foobar"); CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(aMemStream.eof()); @@ -183,17 +183,17 @@ namespace aMemStream.Seek(0); foo[3] = 0; rtl::OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); + CPPUNIT_ASSERT(aTwo == "foo"); CPPUNIT_ASSERT(aMemStream.good()); } void Test::test_read_pstring() { char foo[] = "\3foobar"; - SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); + SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ); rtl::OString aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); + CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); @@ -201,7 +201,7 @@ namespace aMemStream.Seek(0); foo[0] = 10; aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar"))); + CPPUNIT_ASSERT(aFoo == "foobar"); CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(aMemStream.eof()); @@ -211,7 +211,7 @@ namespace foo[0] = 0; foo[1] = 3; aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(aMemStream); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("oob"))); + CPPUNIT_ASSERT(aFoo == "oob"); CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); @@ -223,7 +223,7 @@ namespace foo[2] = 0; foo[3] = 0; aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt32>(aMemStream); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar"))); + CPPUNIT_ASSERT(aFoo == "bar"); CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); @@ -232,19 +232,19 @@ namespace void Test::test_readline() { char foo[] = "foo\nbar\n\n"; - SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); + SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ); rtl::OString aFoo; sal_Bool bRet; bRet = aMemStream.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); + CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT(aMemStream.good()); bRet = aMemStream.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar"))); + CPPUNIT_ASSERT(aFoo == "bar"); CPPUNIT_ASSERT(aMemStream.good()); bRet = aMemStream.ReadLine(aFoo); @@ -265,7 +265,7 @@ namespace CPPUNIT_ASSERT(aFoo.getLength() == 7 && aFoo[3] == 0); CPPUNIT_ASSERT(aMemStream.good()); - std::string sStr(RTL_CONSTASCII_STRINGPARAM(foo)); + std::string sStr(foo, RTL_CONSTASCII_LENGTH(foo)); std::istringstream iss(sStr, std::istringstream::in); std::getline(iss, sStr, '\n'); //embedded null read as expected @@ -291,10 +291,10 @@ namespace CPPUNIT_ASSERT(iss.eof() && !iss.bad()); char bar[] = "foo"; - SvMemoryStream aMemStreamB(RTL_CONSTASCII_STRINGPARAM(bar), STREAM_READ); + SvMemoryStream aMemStreamB((void *) bar, strlen(bar), STREAM_READ); bRet = aMemStreamB.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); + CPPUNIT_ASSERT(aFoo == "foo"); CPPUNIT_ASSERT(!aMemStreamB.eof()); //<-- diff A std::istringstream issB(bar, std::istringstream::in); diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx index 38120aa4c722..c53f2b18fdb7 100644 --- a/tools/qa/cppunit/test_urlobj.cxx +++ b/tools/qa/cppunit/test_urlobj.cxx @@ -74,9 +74,7 @@ namespace tools_urlobj // this is only demonstration code void urlobjTest_001( ) { - INetURLObject aUrl( rtl:: - OUString( RTL_CONSTASCII_USTRINGPARAM - ( "file://10.10.1.1/sampledir/sample.file" ) ) ); + INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). compareToAscii @@ -107,9 +105,7 @@ namespace tools_urlobj { INetURLObject aUrl; aUrl. - setFSysPath( rtl:: - OUString( RTL_CONSTASCII_USTRINGPARAM - ( "\\\\137.65.170.24\\c$\\Img0001.jpg" ) ), + setFSysPath( OUString( "\\\\137.65.170.24\\c$\\Img0001.jpg" ), INetURLObject::FSYS_DETECT ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). @@ -140,9 +136,7 @@ namespace tools_urlobj { INetURLObject aUrl; aUrl. - setFSysPath( rtl:: - OUString( RTL_CONSTASCII_USTRINGPARAM - ( "\\\\hive-winxp-x86\\pmladek\\test2.odt" ) ), + setFSysPath( OUString( "\\\\hive-winxp-x86\\pmladek\\test2.odt" ), INetURLObject::FSYS_DETECT ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). @@ -166,9 +160,7 @@ namespace tools_urlobj void urlobjTest_004( ) { - INetURLObject aUrl( rtl:: - OUString( RTL_CONSTASCII_USTRINGPARAM - ( "smb://10.10.1.1/sampledir/sample.file" ) ) ); + INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). compareToAscii @@ -198,7 +190,7 @@ namespace tools_urlobj void urlobjTest_005( ) { INetURLObject aUrl; - aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//137.65.170.24/c$/Img0001.jpg" ) ), + aUrl.setFSysPath( OUString( "//137.65.170.24/c$/Img0001.jpg" ), INetURLObject::FSYS_DETECT ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). @@ -223,7 +215,7 @@ namespace tools_urlobj void urlobjTest_006( ) { INetURLObject aUrl; - aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//hive-winxp-x86/pmladek/test2.odt" ) ), + aUrl.setFSysPath( OUString( "//hive-winxp-x86/pmladek/test2.odt" ), INetURLObject::FSYS_DETECT ); #ifdef LINUX CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ). @@ -245,8 +237,7 @@ namespace tools_urlobj { // Test with a username part { - INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) ); + INetURLObject aUrl( OUString( "vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ); CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ), OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) ); CPPUNIT_ASSERT_EQUAL( std::string( "username" ), OUSTR_TO_STDSTR( aUrl.GetUser( ) ) ); @@ -257,8 +248,8 @@ namespace tools_urlobj // Test without a username part { - INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) ); + INetURLObject aUrl( OUString( + "vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ); CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ), OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) ); CPPUNIT_ASSERT( !aUrl.HasUserData() ); |