Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a0ab0c79
Kaydet (Commit)
a0ab0c79
authored
Ara 09, 2016
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
CppunitTest_tools_test: fix loplugin:cppunitassertequals warnings
Change-Id: I6738b6b5159403f1654b401a27f08fc829521e73
üst
ff3d175e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
82 deletions
+82
-82
test_stream.cxx
tools/qa/cppunit/test_stream.cxx
+22
-22
test_urlobj.cxx
tools/qa/cppunit/test_urlobj.cxx
+60
-60
No files found.
tools/qa/cppunit/test_stream.cxx
Dosyayı görüntüle @
a0ab0c79
...
...
@@ -46,11 +46,11 @@ namespace
char
std_a
(
78
);
iss
>>
std_a
;
CPPUNIT_ASSERT
(
std_a
==
'f'
);
CPPUNIT_ASSERT
_EQUAL
(
'f'
,
std_a
);
char
tools_a
(
78
);
aMemStream
.
ReadChar
(
tools_a
);
CPPUNIT_ASSERT
(
tools_a
==
'f'
);
CPPUNIT_ASSERT
_EQUAL
(
'f'
,
tools_a
);
iss
.
seekg
(
0
,
std
::
ios_base
::
end
);
//seeking to end doesn't set eof, reading past eof does
...
...
@@ -67,19 +67,19 @@ namespace
//so, now eof is set
CPPUNIT_ASSERT
(
iss
.
eof
());
//a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT
(
std_a
==
78
);
CPPUNIT_ASSERT
_EQUAL
(
static_cast
<
char
>
(
78
),
std_a
);
//nothing wrong with the stream, so not bad
CPPUNIT_ASSERT
(
!
iss
.
bad
());
//yet, the read didn't succeed
CPPUNIT_ASSERT
(
!
iss
.
good
());
CPPUNIT_ASSERT
(
iss
.
rdstate
()
==
(
std
::
ios
::
failbit
|
std
::
ios
::
eofbit
));
CPPUNIT_ASSERT
_EQUAL
((
std
::
ios
::
failbit
|
std
::
ios
::
eofbit
),
iss
.
rdstate
(
));
tools_a
=
78
;
aMemStream
.
ReadChar
(
tools_a
);
//so, now eof is set
CPPUNIT_ASSERT
(
aMemStream
.
eof
());
//a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT
(
tools_a
==
78
);
CPPUNIT_ASSERT
_EQUAL
(
static_cast
<
char
>
(
78
),
tools_a
);
//nothing wrong with the stream, so not bad
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
//yet, the read didn't succeed
...
...
@@ -95,18 +95,18 @@ namespace
aMemStream
.
ReadUInt16
(
tools_b
);
CPPUNIT_ASSERT
(
!
aMemStream
.
good
());
CPPUNIT_ASSERT
(
aMemStream
.
eof
());
CPPUNIT_ASSERT
(
tools_b
==
0x1122
);
CPPUNIT_ASSERT
_EQUAL
(
static_cast
<
sal_uInt16
>
(
0x1122
),
tools_b
);
iss
.
clear
();
iss
.
seekg
(
0
);
CPPUNIT_ASSERT
(
iss
.
good
());
iss
>>
std_a
;
CPPUNIT_ASSERT
(
std_a
==
'f'
);
CPPUNIT_ASSERT
_EQUAL
(
'f'
,
std_a
);
aMemStream
.
Seek
(
0
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
aMemStream
.
ReadChar
(
tools_a
);
CPPUNIT_ASSERT
(
tools_a
==
'f'
);
CPPUNIT_ASSERT
_EQUAL
(
'f'
,
tools_a
);
//failbit is rather subtle wrt e.g seeks
...
...
@@ -116,7 +116,7 @@ namespace
iss
.
seekg
(
0
);
CPPUNIT_ASSERT
(
iss
.
good
());
iss
.
read
(
buffer
,
sizeof
(
buffer
));
CPPUNIT_ASSERT
(
iss
.
gcount
()
==
3
);
CPPUNIT_ASSERT
_EQUAL
(
static_cast
<
std
::
streamsize
>
(
3
),
iss
.
gcount
()
);
CPPUNIT_ASSERT
(
!
iss
.
good
());
CPPUNIT_ASSERT
(
!
iss
.
bad
());
CPPUNIT_ASSERT
(
iss
.
eof
());
...
...
@@ -124,7 +124,7 @@ namespace
aMemStream
.
Seek
(
0
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
std
::
size_t
nRet
=
aMemStream
.
ReadBytes
(
buffer
,
sizeof
(
buffer
));
CPPUNIT_ASSERT
(
nRet
==
3
);
CPPUNIT_ASSERT
_EQUAL
(
static_cast
<
std
::
size_t
>
(
3
),
nRet
);
CPPUNIT_ASSERT
(
!
aMemStream
.
good
());
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
CPPUNIT_ASSERT
(
aMemStream
.
eof
());
...
...
@@ -136,10 +136,10 @@ namespace
SvMemoryStream
aMemStream
(
foo
,
SAL_N_ELEMENTS
(
foo
)
-
1
,
StreamMode
::
READ
);
OString
aOne
=
read_uInt8s_ToOString
(
aMemStream
,
3
);
CPPUNIT_ASSERT
(
aOne
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foo"
),
aOne
);
OString
aTwo
=
read_uInt8s_ToOString
(
aMemStream
,
3
);
CPPUNIT_ASSERT
(
aTwo
==
"bar"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"bar"
),
aTwo
);
OString
aThree
=
read_uInt8s_ToOString
(
aMemStream
,
3
);
CPPUNIT_ASSERT
(
aThree
.
isEmpty
());
...
...
@@ -147,7 +147,7 @@ namespace
aMemStream
.
Seek
(
0
);
OString
aFour
=
read_uInt8s_ToOString
(
aMemStream
,
100
);
CPPUNIT_ASSERT
(
aFour
==
foo
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
foo
),
aFour
);
}
void
Test
::
test_read_cstring
()
...
...
@@ -156,7 +156,7 @@ namespace
SvMemoryStream
aMemStream
(
foo
,
SAL_N_ELEMENTS
(
foo
)
-
1
,
StreamMode
::
READ
);
OString
aOne
=
read_zeroTerminated_uInt8s_ToOString
(
aMemStream
);
CPPUNIT_ASSERT
(
aOne
==
"foobar"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foobar"
),
aOne
);
CPPUNIT_ASSERT
(
!
aMemStream
.
good
());
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
CPPUNIT_ASSERT
(
aMemStream
.
eof
());
...
...
@@ -164,7 +164,7 @@ namespace
aMemStream
.
Seek
(
0
);
foo
[
3
]
=
0
;
OString
aTwo
=
read_zeroTerminated_uInt8s_ToOString
(
aMemStream
);
CPPUNIT_ASSERT
(
aTwo
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foo"
),
aTwo
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
}
...
...
@@ -174,7 +174,7 @@ namespace
SvMemoryStream
aMemStream
(
foo
,
SAL_N_ELEMENTS
(
foo
)
-
1
,
StreamMode
::
READ
);
OString
aFoo
=
read_uInt8_lenPrefixed_uInt8s_ToOString
(
aMemStream
);
CPPUNIT_ASSERT
(
aFoo
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foo"
),
aFoo
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
CPPUNIT_ASSERT
(
!
aMemStream
.
eof
());
...
...
@@ -182,7 +182,7 @@ namespace
aMemStream
.
Seek
(
0
);
foo
[
0
]
=
10
;
aFoo
=
read_uInt8_lenPrefixed_uInt8s_ToOString
(
aMemStream
);
CPPUNIT_ASSERT
(
aFoo
==
"foobar"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foobar"
),
aFoo
);
CPPUNIT_ASSERT
(
!
aMemStream
.
good
());
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
CPPUNIT_ASSERT
(
aMemStream
.
eof
());
...
...
@@ -192,7 +192,7 @@ namespace
foo
[
0
]
=
0
;
foo
[
1
]
=
3
;
aFoo
=
read_uInt16_lenPrefixed_uInt8s_ToOString
(
aMemStream
);
CPPUNIT_ASSERT
(
aFoo
==
"oob"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"oob"
),
aFoo
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
CPPUNIT_ASSERT
(
!
aMemStream
.
bad
());
CPPUNIT_ASSERT
(
!
aMemStream
.
eof
());
...
...
@@ -208,12 +208,12 @@ namespace
bRet
=
aMemStream
.
ReadLine
(
aFoo
);
CPPUNIT_ASSERT
(
bRet
);
CPPUNIT_ASSERT
(
aFoo
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foo"
),
aFoo
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
bRet
=
aMemStream
.
ReadLine
(
aFoo
);
CPPUNIT_ASSERT
(
bRet
);
CPPUNIT_ASSERT
(
aFoo
==
"bar"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"bar"
),
aFoo
);
CPPUNIT_ASSERT
(
aMemStream
.
good
());
bRet
=
aMemStream
.
ReadLine
(
aFoo
);
...
...
@@ -263,12 +263,12 @@ namespace
SvMemoryStream
aMemStreamB
(
bar
,
SAL_N_ELEMENTS
(
bar
)
-
1
,
StreamMode
::
READ
);
bRet
=
aMemStreamB
.
ReadLine
(
aFoo
);
CPPUNIT_ASSERT
(
bRet
);
CPPUNIT_ASSERT
(
aFoo
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
OString
(
"foo"
),
aFoo
);
CPPUNIT_ASSERT
(
!
aMemStreamB
.
eof
());
//<-- diff A
std
::
istringstream
issB
(
bar
,
std
::
istringstream
::
in
);
std
::
getline
(
issB
,
sStr
,
'\n'
);
CPPUNIT_ASSERT
(
sStr
==
"foo"
);
CPPUNIT_ASSERT
_EQUAL
(
std
::
string
(
"foo"
),
sStr
);
CPPUNIT_ASSERT
(
issB
.
eof
());
//<-- diff A
}
...
...
tools/qa/cppunit/test_urlobj.cxx
Dosyayı görüntüle @
a0ab0c79
...
...
@@ -49,23 +49,23 @@ namespace tools_urlobj
{
INetURLObject
aUrl
(
OUString
(
"file://10.10.1.1/sampledir/sample.file"
)
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://10.10.1.1/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://10.10.1.1/sampledir/sample.file"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
()
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://10.10.1.1/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"10.10.1.1"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
getName
(
)
==
"sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
getBase
(
)
==
"sample"
);
CPPUNIT_ASSERT
(
aUrl
.
getExtension
(
)
==
"file"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"10.10.1.1"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/sampledir/sample.file"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"sample.file"
),
aUrl
.
getName
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"sample"
),
aUrl
.
getBase
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"file"
),
aUrl
.
getExtension
()
);
}
void
urlobjTest_002
(
)
...
...
@@ -75,22 +75,22 @@ namespace tools_urlobj
setFSysPath
(
"
\\\\
137.65.170.24
\\
c$
\\
Img0001.jpg"
,
FSysStyle
::
Detect
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://137.65.170.24/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://137.65.170.24/c$/Img0001.jpg"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
()
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://137.65.170.24/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"137.65.170.24"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
getName
(
)
==
"Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
getBase
(
)
==
"Img0001"
);
CPPUNIT_ASSERT
(
aUrl
.
getExtension
(
)
==
"jpg"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"137.65.170.24"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/c$/Img0001.jpg"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"Img0001.jpg"
),
aUrl
.
getName
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"Img0001"
),
aUrl
.
getBase
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"jpg"
),
aUrl
.
getExtension
()
);
}
...
...
@@ -101,41 +101,41 @@ namespace tools_urlobj
setFSysPath
(
"
\\\\
hive-winxp-x86
\\
pmladek
\\
test2.odt"
,
FSysStyle
::
Detect
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://hive-winxp-x86/pmladek/test2.odt"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://hive-winxp-x86/pmladek/test2.odt"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
()
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://hive-winxp-x86/pmladek/test2.odt"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"hive-winxp-x86"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/pmladek/test2.odt"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"hive-winxp-x86"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/pmladek/test2.odt"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
}
void
urlobjTest_004
(
)
{
INetURLObject
aUrl
(
OUString
(
"smb://10.10.1.1/sampledir/sample.file"
)
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://10.10.1.1/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://10.10.1.1/sampledir/sample.file"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
(
)
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://10.10.1.1/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"10.10.1.1"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/sampledir/sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
getName
(
)
==
"sample.file"
);
CPPUNIT_ASSERT
(
aUrl
.
getBase
(
)
==
"sample"
);
CPPUNIT_ASSERT
(
aUrl
.
getExtension
(
)
==
"file"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"10.10.1.1"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/sampledir/sample.file"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"sample.file"
),
aUrl
.
getName
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"sample"
),
aUrl
.
getBase
()
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"file"
),
aUrl
.
getExtension
()
);
}
void
urlobjTest_005
(
)
...
...
@@ -144,22 +144,22 @@ namespace tools_urlobj
aUrl
.
setFSysPath
(
"//137.65.170.24/c$/Img0001.jpg"
,
FSysStyle
::
Detect
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://137.65.170.24/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://137.65.170.24/c$/Img0001.jpg"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
()
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://137.65.170.24/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"137.65.170.24"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/c$/Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
getName
(
)
==
"Img0001.jpg"
);
CPPUNIT_ASSERT
(
aUrl
.
getBase
(
)
==
"Img0001"
);
CPPUNIT_ASSERT
(
aUrl
.
getExtension
(
)
==
"jpg"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"137.65.170.24"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/c$/Img0001.jpg"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"Img0001.jpg"
),
aUrl
.
getName
(
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"Img0001"
),
aUrl
.
getBase
(
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"jpg"
),
aUrl
.
getExtension
(
)
);
}
...
...
@@ -169,19 +169,19 @@ namespace tools_urlobj
aUrl
.
setFSysPath
(
"//hive-winxp-x86/pmladek/test2.odt"
,
FSysStyle
::
Detect
);
#ifdef LINUX
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"smb://hive-winxp-x86/pmladek/test2.odt"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
Smb
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"smb://hive-winxp-x86/pmladek/test2.odt"
),
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
INetProtocol
::
Smb
,
aUrl
.
GetProtocol
()
);
#endif
#ifdef _WIN32
CPPUNIT_ASSERT
(
aUrl
.
GetMainURL
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"file://hive-winxp-x86/pmladek/test2.odt"
);
CPPUNIT_ASSERT
(
aUrl
.
GetProtocol
(
)
==
INetProtocol
::
File
);
#endif
CPPUNIT_ASSERT
(
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"hive-winxp-x86"
);
CPPUNIT_ASSERT
(
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
==
"/pmladek/test2.odt"
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"hive-winxp-x86"
),
aUrl
.
GetHost
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"/pmladek/test2.odt"
),
aUrl
.
GetURLPath
(
INetURLObject
::
DecodeMechanism
::
NONE
)
);
}
void
urlobjCmisTest
(
)
...
...
@@ -239,7 +239,7 @@ namespace tools_urlobj
url
=
INetURLObject
(
"data:"
);
//TODO: CPPUNIT_ASSERT(url.HasError());
strm
=
url
.
getData
();
CPPUNIT_ASSERT
(
strm
==
nullptr
);
CPPUNIT_ASSERT
(
!
strm
);
url
=
INetURLObject
(
"data:,"
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
...
...
@@ -263,7 +263,7 @@ namespace tools_urlobj
url
=
INetURLObject
(
"data:base64,"
);
//TODO: CPPUNIT_ASSERT(url.HasError());
strm
=
url
.
getData
();
CPPUNIT_ASSERT
(
strm
==
nullptr
);
CPPUNIT_ASSERT
(
!
strm
);
url
=
INetURLObject
(
"data:;base64,"
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
...
...
@@ -294,12 +294,12 @@ namespace tools_urlobj
url
=
INetURLObject
(
"data:;base64,YWJjCg="
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
strm
=
url
.
getData
();
CPPUNIT_ASSERT
(
strm
==
nullptr
);
CPPUNIT_ASSERT
(
!
strm
);
url
=
INetURLObject
(
"data:;base64,YWJ$Cg=="
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
strm
=
url
.
getData
();
CPPUNIT_ASSERT
(
strm
==
nullptr
);
CPPUNIT_ASSERT
(
!
strm
);
url
=
INetURLObject
(
"data:text/plain;param=%22;base64,%22,YQ=="
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
...
...
@@ -316,7 +316,7 @@ namespace tools_urlobj
url
=
INetURLObject
(
"http://example.com"
);
CPPUNIT_ASSERT
(
!
url
.
HasError
());
strm
=
url
.
getData
();
CPPUNIT_ASSERT
(
strm
==
nullptr
);
CPPUNIT_ASSERT
(
!
strm
);
}
void
urlobjTest_isSchemeEqualTo
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment