1 diff -Ncr tools_orig/qa/urlobj/export.map tools/qa/urlobj/export.map
2 --- tools_orig/qa/urlobj/export.map 1970-01-01 01:00:00.000000000 +0100
3 +++ tools/qa/urlobj/export.map 2007-06-14 16:40:41.000000000 +0200
7 + registerAllTestFunction;
12 diff -Ncr tools_orig/qa/urlobj/makefile.mk tools/qa/urlobj/makefile.mk
13 --- tools_orig/qa/urlobj/makefile.mk 1970-01-01 01:00:00.000000000 +0100
14 +++ tools/qa/urlobj/makefile.mk 2007-06-14 16:50:28.000000000 +0200
16 + #*************************************************************************
18 + # OpenOffice.org - a multi-platform office productivity suite
20 + # $RCSfile: makefile.mk,v $
24 + # last change: $Author: rt $ $Date: 2005/09/08 15:49:44 $
26 + # The Contents of this file are made available subject to
27 + # the terms of GNU Lesser General Public License Version 2.1.
30 + # GNU Lesser General Public License Version 2.1
31 + # =============================================
32 + # Copyright 2005 by Sun Microsystems, Inc.
33 + # 901 San Antonio Road, Palo Alto, CA 94303, USA
35 + # This library is free software; you can redistribute it and/or
36 + # modify it under the terms of the GNU Lesser General Public
37 + # License version 2.1, as published by the Free Software Foundation.
39 + # This library is distributed in the hope that it will be useful,
40 + # but WITHOUT ANY WARRANTY; without even the implied warranty of
41 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 + # Lesser General Public License for more details.
44 + # You should have received a copy of the GNU Lesser General Public
45 + # License along with this library; if not, write to the Free Software
46 + # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
49 + #*************************************************************************
53 + TARGET=qa_tools_urlobj_test
54 + # this is removed at the moment because we need some enhancements
57 + ENABLE_EXCEPTIONS=TRUE
59 + # --- Settings -----------------------------------------------------
61 + .INCLUDE : settings.mk
63 + # BEGIN ----------------------------------------------------------------
64 + # auto generated Target:job by codegen.pl
66 + $(SLO)$/tools_urlobj_test.obj
68 + SHL1TARGET= tools_urlobj
74 + SHL1IMPLIB= i$(SHL1TARGET)
75 + DEF1NAME =$(SHL1TARGET)
76 + SHL1VERSIONMAP= export.map
77 + # auto generated Target:job
78 + # END ------------------------------------------------------------------
80 + #------------------------------- All object files -------------------------------
81 + # do this here, so we get right dependencies
82 + # SLOFILES=$(SHL1OBJS)
84 + # --- Targets ------------------------------------------------------
86 + .INCLUDE : target.mk
87 + .INCLUDE : _cppunit.mk
88 diff -Ncr tools_orig/qa/urlobj/tools_urlobj_test.cxx tools/qa/urlobj/tools_urlobj_test.cxx
89 --- tools_orig/qa/urlobj/tools_urlobj_test.cxx 1970-01-01 01:00:00.000000000 +0100
90 +++ tools/qa/urlobj/tools_urlobj_test.cxx 2007-06-14 18:33:36.000000000 +0200
92 + /*************************************************************************
94 + * OpenOffice.org - a multi-platform office productivity suite
100 + * last change: $Author: $ $Date: $
102 + * The Contents of this file are made available subject to
103 + * the terms of GNU Lesser General Public License Version 2.1.
106 + * GNU Lesser General Public License Version 2.1
107 + * =============================================
108 + * Copyright 2005 by Sun Microsystems, Inc.
109 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
111 + * This library is free software; you can redistribute it and/or
112 + * modify it under the terms of the GNU Lesser General Public
113 + * License version 2.1, as published by the Free Software Foundation.
115 + * This library is distributed in the hope that it will be useful,
116 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
117 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
118 + * Lesser General Public License for more details.
120 + * You should have received a copy of the GNU Lesser General Public
121 + * License along with this library; if not, write to the Free Software
122 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
123 + * MA 02111-1307 USA
125 + ************************************************************************/
127 + #include <cppunit/simpleheader.hxx>
129 + #include <urlobj.hxx>
131 + namespace tools_urlobj
134 + class urlobjTest : public CppUnit::TestFixture
138 + // initialise your test code values here.
147 + // insert your test code here.
148 + // this is only demonstration code
149 + void urlobjTest_001()
151 + INetURLObject aUrl(rtl::OUString::createFromAscii("file://10.10.1.1/sampledir/sample.file"));
153 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0);
154 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
157 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0);
158 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
160 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0);
161 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0);
162 + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0);
163 + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0);
164 + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0);
167 + void urlobjTest_002()
169 + INetURLObject aUrl;
170 + aUrl.setFSysPath(rtl::OUString::createFromAscii("\\\\137.65.170.24\\c$\\Img0001.jpg"), INetURLObject::FSYS_DETECT);
172 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0);
173 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
176 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0);
177 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
179 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0);
180 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0);
181 + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0);
182 + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0);
183 + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0);
187 + void urlobjTest_003()
189 + INetURLObject aUrl;
190 + aUrl.setFSysPath(rtl::OUString::createFromAscii("\\\\hive-winxp-x86\\pmladek\\test2.odt"), INetURLObject::FSYS_DETECT);
192 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0);
193 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
196 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0);
197 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
199 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0);
200 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0);
203 + void urlobjTest_004()
205 + INetURLObject aUrl(rtl::OUString::createFromAscii("smb://10.10.1.1/sampledir/sample.file"));
207 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://10.10.1.1/sampledir/sample.file")==0);
208 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
211 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://10.10.1.1/sampledir/sample.file")==0);
212 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
214 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("10.10.1.1")==0);
215 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/sampledir/sample.file")==0);
216 + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("sample.file")==0);
217 + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("sample")==0);
218 + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("file")==0);
221 + void urlobjTest_005()
223 + INetURLObject aUrl;
224 + aUrl.setFSysPath(rtl::OUString::createFromAscii("//137.65.170.24/c$/Img0001.jpg"), INetURLObject::FSYS_DETECT);
226 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://137.65.170.24/c$/Img0001.jpg")==0);
227 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
230 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://137.65.170.24/c$/Img0001.jpg")==0);
231 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
233 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("137.65.170.24")==0);
234 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/c$/Img0001.jpg")==0);
235 + CPPUNIT_ASSERT(aUrl.getName().compareToAscii("Img0001.jpg")==0);
236 + CPPUNIT_ASSERT(aUrl.getBase().compareToAscii("Img0001")==0);
237 + CPPUNIT_ASSERT(aUrl.getExtension().compareToAscii("jpg")==0);
241 + void urlobjTest_006()
243 + INetURLObject aUrl;
244 + aUrl.setFSysPath(rtl::OUString::createFromAscii("//hive-winxp-x86/pmladek/test2.odt"), INetURLObject::FSYS_DETECT);
246 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("smb://hive-winxp-x86/pmladek/test2.odt")==0);
247 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_SMB);
250 + CPPUNIT_ASSERT(aUrl.GetMainURL(INetURLObject::NO_DECODE).compareToAscii("file://hive-winxp-x86/pmladek/test2.odt")==0);
251 + CPPUNIT_ASSERT(aUrl.GetProtocol()==INET_PROT_FILE);
253 + CPPUNIT_ASSERT(aUrl.GetHost(INetURLObject::NO_DECODE).compareToAscii("hive-winxp-x86")==0);
254 + CPPUNIT_ASSERT(aUrl.GetURLPath(INetURLObject::NO_DECODE).compareToAscii("/pmladek/test2.odt")==0);
259 + // Change the following lines only, if you add, remove or rename
260 + // member functions of the current class,
261 + // because these macros are need by auto register mechanism.
263 + CPPUNIT_TEST_SUITE(urlobjTest);
264 + CPPUNIT_TEST(urlobjTest_001);
265 + CPPUNIT_TEST(urlobjTest_002);
266 + CPPUNIT_TEST(urlobjTest_003);
267 + CPPUNIT_TEST(urlobjTest_004);
268 + CPPUNIT_TEST(urlobjTest_005);
269 + CPPUNIT_TEST(urlobjTest_006);
270 + CPPUNIT_TEST_SUITE_END();
271 + }; // class createPool
274 + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tools_urlobj::urlobjTest, "tools_urlobj");
275 + } // namespace rtl_random
278 + // -----------------------------------------------------------------------------
280 + // this macro creates an empty function, which will called by the RegisterAllFunctions()
281 + // to let the user the possibility to also register some functions by hand.