1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SAL_QA_OSL_FILE_OSL_FILE_CONST_H
21 #define INCLUDED_SAL_QA_OSL_FILE_OSL_FILE_CONST_H
26 #include <sal/types.h>
28 #include <rtl/ustring.hxx>
35 // common used string resource
36 // these common used string will be used as assist resource in test
37 // they are mostly OS independent, some of the resource can be reused
38 // so, a common test data repository will be better since it can be
39 // shared among all test code
41 const sal_Char pBuffer_Char
[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
42 const sal_Char pBuffer_Number
[] = "1234567890";
43 const sal_Char pBuffer_Blank
[] = "";
45 // OS dependent/independent definitions/includes
46 // we use FILE_PREFIX for URL prefix,
47 // TEST_PLATFORM for test platform initial,
48 // TEST_PLATFORM_ROOT for root dir in comrresponding platform,
49 // TEST_PLATFORM_TEMP for temp dir in comrresponding platform,
50 // PATH_LIST_DELIMITER for separator of path list in comrresponding platform,
51 // PATH_SEPARATOR for separator in URL or system path in comrresponding platform,
52 // PATH_MAX/MAX_PATH for max path length in comrresponding platform,
54 // OS independent const definition
56 # define FILE_PREFIX "file:///"
57 # define TEST_FILE_SIZE 1024
59 // OS dependent declaration and includes
61 #if ( defined UNX ) //Unix
67 # include <sys/stat.h>
68 # if !defined(MACOSX) && !defined(IOS) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined (DRAGONFLY) && !defined(HAIKU)
69 # include <sys/statfs.h>
71 # include <sys/param.h>
73 # include <sys/mount.h>
76 # if !defined(ANDROID)
77 # include <sys/statvfs.h>
79 # include <sys/types.h>
80 # define TEST_PLATFORM ""
81 # define TEST_PLATFORM_ROOT "/"
82 # define TEST_PLATFORM_TEMP "tmp"
83 # define PATH_LIST_DELIMITER ":"
84 # define PATH_SEPARATOR "/"
87 #if defined(_WIN32) // Windows
89 # define PATH_MAX MAX_PATH
90 # define TEST_PLATFORM "c:/"
91 # define TEST_PLATFORM_ROOT "c:/"
92 # define TEST_PLATFORM_TEMP "temp"
93 # define PATH_LIST_DELIMITER ";"
94 # define PATH_SEPARATOR "/"
97 // OS independent file definition
99 OUString
aNullURL( "" );
100 OUString
aSlashURL( PATH_SEPARATOR
);
101 OUString
aPreURL( FILE_PREFIX
);
102 OUString
aRootURL( FILE_PREFIX TEST_PLATFORM
);
104 OUString
aTempDirectoryURL( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
);
105 OUString
aTempDirectorySys( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
);
106 OUString
aUserDirectoryURL( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"" );
107 OUString
aUserDirectorySys( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"" );
109 // common used URL:temp, canonical, root, relative, link,etc
111 OUString
aCanURL1( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/canonical.name" );
113 RTL_CONSTASCII_USTRINGPARAM("ca@#;+.,$///78no\0ni..name"));
114 OUString
aCanURL3( "ca@#;+.,$//tmp/678nonical//name" );
115 OUString
aCanURL4( "canonical.name" );
116 OUString
aTmpName1( "tmpdir" );
117 OUString
aTmpName2( "tmpname" );
118 OUString
aTmpName3( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpdir" );
119 OUString
aTmpName4( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpdir/tmpname" );
120 OUString
aTmpName5( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpdir/../tmpdir/./tmpname" );
121 OUString
aTmpName6( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpname" );
122 OUString
aTmpName7( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/noaccess" );
123 OUString
aTmpName8( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpname/tmpdir" );
124 OUString
aTmpName9( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/tmpdir/../tmpdir/./" );
125 OUString
aTmpName10(RTL_CONSTASCII_USTRINGPARAM( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/\xE6\x9C\xAA\xE5\x91\xBD\xE5\x90\x8Dzhgb18030" ));
127 OUString
aRelURL1( "relative/file1" );
128 OUString
aRelURL2( "relative/./file2" );
129 OUString
aRelURL3( "relative/../file3" );
130 OUString
aRelURL4( "././relative/../file4" );
131 OUString
aRelURL5( TEST_PLATFORM_TEMP
"/./../" TEST_PLATFORM_TEMP
);
132 OUString
aLnkURL1( FILE_PREFIX TEST_PLATFORM TEST_PLATFORM_TEMP
"/link.file" );
133 OUString
aHidURL1( ".hiddenfile" );
135 // common used System Path:temp, root,etc
137 OUString
aRootSys( TEST_PLATFORM_ROOT
);
138 OUString
aSysPath1( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/system.path" );
139 OUString
aSysPath2( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/system/path" );
140 OUString
aSysPath3( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/tmpdir" );
141 OUString
aSysPath4( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/tmpname" );
142 OUString
aSysPath5(RTL_CONSTASCII_USTRINGPARAM( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/\xE6\x9C\xAA\xE5\x91\xBD\xE5\x90\x8Dzhgb18030" ));
143 OUString
aSysPathLnk( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/link.file" );
144 OUString
aFifoSys( TEST_PLATFORM_ROOT TEST_PLATFORM_TEMP
"/tmpdir/fifo" );
146 // FileType URL, we pick some canonical file in corresponding system for test:
147 // socket, link, etc.
148 // Note that this may be changed in the different platform, so be careful to use.
150 #if ( defined UNX ) // Unix
151 OUString
aTypeURL1( FILE_PREFIX
"dev/ccv"); //socket Solaris/Linux
152 OUString
aTypeURL2( FILE_PREFIX
"devices/pseudo/tcp@0:tcp"); //special Solaris/Linux
153 OUString
aTypeURL3( FILE_PREFIX
"lib" ); //link Solaris
155 OUString
aTypeURL1( FILE_PREFIX
"" );
156 OUString
aTypeURL2( FILE_PREFIX
"" );
157 OUString
aTypeURL3( FILE_PREFIX
"" );
160 // Volume device URL, we pick some canonical volume device for test:
161 // UNIX file system, Floppy Disk, Proc file system, Temp file system, Compact Disk.
163 #if ( defined UNX ) // Unix
164 OUString
aVolURL1( FILE_PREFIX
""); //ufs Solaris/Linux
166 OUString
aVolURL2( FILE_PREFIX
"dev/fd" ); //fd Solaris
168 OUString
aVolURL2( FILE_PREFIX
"dev/floppy/0u1440" ); //fd0 Linux
170 OUString
aVolURL3( FILE_PREFIX
"proc" ); //proc Solaris/Linux
171 OUString
aVolURL4( FILE_PREFIX
"staroffice" ); //nfs Solaris/Linux
172 OUString
aVolURL5( FILE_PREFIX
"tmp" ); //tmpfs Solaris
173 OUString
aVolURL6( FILE_PREFIX
"cdrom" ); //cd Solaris
175 OUString
aVolURL1( FILE_PREFIX
"c:/" );
176 OUString
aVolURL2( FILE_PREFIX
"a:/" );
177 OUString
aVolURL3( FILE_PREFIX
"" );
178 OUString
aVolURL4( FILE_PREFIX
"" );
179 OUString
aVolURL5( FILE_PREFIX
"c:/temp" );
180 OUString
aVolURL6( FILE_PREFIX
"e:/" );
187 #endif // INCLUDED_SAL_QA_OSL_FILE_OSL_FILE_CONST_H
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */