1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "sal/config.h"
30 #include "sal/precppunit.hxx"
32 #include <cppunit/simpleheader.hxx>
34 #include <rtl/ustring.hxx>
37 # define TEST_PATH_1 "c:\\"
38 # define TEST_PATH_2 "c:\\mnt\\MSDN"
39 # define TEST_PATH_3 "c:\\Program Files"
40 # define TEST_PATH_4 "\\\\Tra-1\\mnt\\c"
41 # define TEST_PATH_5 "\\\\Tra-1\\mnt"
42 # define TEST_PATH_6 "\\\\Tra-1\\mnt\\c\\"
44 # define TEST_PATH_1 "/net/athene/export/home/tra"
45 # define TEST_PATH_2 "/net/athene/export/home/tra/"
46 # define TEST_PATH_3 "/"
47 # define TEST_PATH_4 "."
48 # define TEST_PATH_5 "/net/athene/export/home/tra/projects"
49 # define TEST_PATH_6 "/blah"
52 void test_getVolumeInformation(const rtl::OUString
& path_url
)
55 memset((void*)&vi
, 0, sizeof(vi
));
56 vi
.uStructSize
= sizeof(vi
);
57 vi
.pDeviceHandle
= NULL
;
59 oslFileError err
= osl_getVolumeInformation(
62 osl_VolumeInfo_Mask_Attributes
|
63 osl_VolumeInfo_Mask_TotalSpace
|
64 osl_VolumeInfo_Mask_UsedSpace
|
65 osl_VolumeInfo_Mask_FreeSpace
|
66 osl_VolumeInfo_Mask_MaxNameLength
|
67 osl_VolumeInfo_Mask_MaxPathLength
|
68 osl_VolumeInfo_Mask_FileSystemName
|
69 osl_VolumeInfo_Mask_DeviceHandle
);
71 CPPUNIT_ASSERT_MESSAGE
73 "osl_getVolumeInformation failed",
74 err
== osl_File_E_None
78 class TestClass_osl_getVolumeInformation
: public CppUnit::TestFixture
82 /*-------------------------------------
83 Start a process and join with this
84 process specify a timeout so that
85 osl_joinProcessWithTimeout returns
86 osl_Process_E_TimedOut
87 -------------------------------------*/
89 void test_osl_getVolumeInformation()
91 rtl::OUString path
= rtl::OUString(TEST_PATH_1
);
92 rtl::OUString path_url
;
93 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
94 test_getVolumeInformation(path_url
);
96 path
= rtl::OUString(TEST_PATH_2
);
97 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
98 test_getVolumeInformation(path_url
);
100 path
= rtl::OUString(TEST_PATH_3
);
101 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
102 test_getVolumeInformation(path_url
);
104 path
= rtl::OUString(TEST_PATH_4
);
105 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
106 test_getVolumeInformation(path_url
);
108 path
= rtl::OUString(TEST_PATH_5
);
109 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
110 test_getVolumeInformation(path_url
);
112 path
= rtl::OUString(TEST_PATH_6
);
113 osl_getFileURLFromSystemPath(path
.pData
, &path_url
.pData
);
114 test_getVolumeInformation(path_url
);
117 CPPUNIT_TEST_SUITE( TestClass_osl_getVolumeInformation
);
118 CPPUNIT_TEST( test_osl_getVolumeInformation
);
119 CPPUNIT_TEST_SUITE_END( );
122 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestClass_osl_getVolumeInformation
, "Test osl_getVolumeInformation");
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */