1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sal.hxx"
31 #include <cppunit/simpleheader.hxx>
33 #include <rtl/ustring.hxx>
36 # define TEST_PATH_1 "c:\\"
37 # define TEST_PATH_2 "c:\\mnt\\MSDN"
38 # define TEST_PATH_3 "c:\\Program Files"
39 # define TEST_PATH_4 "\\\\Tra-1\\mnt\\c"
40 # define TEST_PATH_5 "\\\\Tra-1\\mnt"
41 # define TEST_PATH_6 "\\\\Tra-1\\mnt\\c\\"
43 # define TEST_PATH_1 "/net/athene/export/home/tra"
44 # define TEST_PATH_2 "/net/athene/export/home/tra/"
45 # define TEST_PATH_3 "/"
46 # define TEST_PATH_4 "."
47 # define TEST_PATH_5 "/net/athene/export/home/tra/projects"
48 # define TEST_PATH_6 "/blah"
51 //------------------------------
53 //------------------------------
55 void test_getVolumeInformation(const rtl::OUString
& path_url
)
58 memset((void*)&vi
, 0, sizeof(vi
));
59 vi
.uStructSize
= sizeof(vi
);
60 vi
.pDeviceHandle
= NULL
;
62 oslFileError err
= osl_getVolumeInformation(
65 osl_VolumeInfo_Mask_Attributes
|
66 osl_VolumeInfo_Mask_TotalSpace
|
67 osl_VolumeInfo_Mask_UsedSpace
|
68 osl_VolumeInfo_Mask_FreeSpace
|
69 osl_VolumeInfo_Mask_MaxNameLength
|
70 osl_VolumeInfo_Mask_MaxPathLength
|
71 osl_VolumeInfo_Mask_FileSystemName
|
72 osl_VolumeInfo_Mask_DeviceHandle
);
74 CPPUNIT_ASSERT_MESSAGE
76 "osl_getVolumeInformation failed",
77 err
== osl_File_E_None
81 //------------------------------
83 //------------------------------
85 class TestClass_osl_getVolumeInformation
: public CppUnit::TestFixture
89 /*-------------------------------------
90 Start a process and join with this
91 process specify a timeout so that
92 osl_joinProcessWithTimeout returns
93 osl_Process_E_TimedOut
94 -------------------------------------*/
96 void test_osl_getVolumeInformation()
98 rtl::OUString path
= rtl::OUString::createFromAscii(TEST_PATH_1
);
99 rtl::OUString path_url
;
100 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
101 test_getVolumeInformation(path_url
);
103 path
= rtl::OUString::createFromAscii(TEST_PATH_2
);
104 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
105 test_getVolumeInformation(path_url
);
107 path
= rtl::OUString::createFromAscii(TEST_PATH_3
);
108 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
109 test_getVolumeInformation(path_url
);
111 path
= rtl::OUString::createFromAscii(TEST_PATH_4
);
112 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
113 test_getVolumeInformation(path_url
);
115 path
= rtl::OUString::createFromAscii(TEST_PATH_5
);
116 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
117 test_getVolumeInformation(path_url
);
119 path
= rtl::OUString::createFromAscii(TEST_PATH_6
);
120 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
121 test_getVolumeInformation(path_url
);
124 CPPUNIT_TEST_SUITE( TestClass_osl_getVolumeInformation
);
125 CPPUNIT_TEST( test_osl_getVolumeInformation
);
126 CPPUNIT_TEST_SUITE_END( );
129 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestClass_osl_getVolumeInformation
, "Test osl_getVolumeInformation");