5142
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2002 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
3892
|
13 |
"{ Package: 'stx:libtool' }"
|
|
14 |
|
|
15 |
TestCase subclass:#FileBrowserV2Tests
|
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-Tools-File'
|
|
20 |
!
|
|
21 |
|
|
22 |
!FileBrowserV2Tests class methodsFor:'documentation'!
|
|
23 |
|
5142
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 2002 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
3892
|
38 |
documentation
|
|
39 |
"
|
|
40 |
documentation to be added.
|
|
41 |
|
|
42 |
[author:]
|
|
43 |
Christian Penk (penk@bierfix)
|
|
44 |
|
|
45 |
[instance variables:]
|
|
46 |
|
|
47 |
[class variables:]
|
|
48 |
|
|
49 |
[see also:]
|
|
50 |
|
|
51 |
"
|
|
52 |
! !
|
|
53 |
|
|
54 |
!FileBrowserV2Tests methodsFor:'initialize / release'!
|
|
55 |
|
|
56 |
setUp
|
|
57 |
"common setup - invoked before testing"
|
|
58 |
|
|
59 |
super setUp
|
|
60 |
!
|
|
61 |
|
|
62 |
tearDown
|
|
63 |
"common cleanup - invoked after testing"
|
|
64 |
|
|
65 |
super tearDown
|
|
66 |
! !
|
|
67 |
|
|
68 |
!FileBrowserV2Tests methodsFor:'tests'!
|
|
69 |
|
4344
|
70 |
createBigDirectory
|
|
71 |
|
4623
|
72 |
| testDir |
|
|
73 |
|
|
74 |
testDir := Filename homeDirectory construct:'Test'.
|
4344
|
75 |
(Filename homeDirectory construct:'Test') makeDirectory.
|
|
76 |
1 to:5 do:[: id1|
|
|
77 |
1 to:50 do:[: id2|
|
|
78 |
1 to:50 do:[: id3|
|
4623
|
79 |
(testDir construct:('file', id1 asString, '.', id2 asString,'.', id3 asString)) writeStream
|
4344
|
80 |
]
|
|
81 |
].
|
|
82 |
]
|
|
83 |
"
|
|
84 |
FileBrowserV2Tests new createBigDirectory
|
5228
|
85 |
Dialog requestFileName:'test' default:nil pattern:'*' fromDirectory:'/home/penk/Test'
|
4344
|
86 |
"
|
|
87 |
!
|
|
88 |
|
|
89 |
removeBigDirectory
|
|
90 |
|
|
91 |
(Filename homeDirectory construct:'Test') recursiveRemove.
|
|
92 |
|
|
93 |
"
|
|
94 |
FileBrowserV2Tests new removeBigDirectory
|
|
95 |
"
|
|
96 |
!
|
|
97 |
|
|
98 |
testBigDirectory
|
|
99 |
!
|
|
100 |
|
3953
|
101 |
testDirectoryHistory
|
|
102 |
"Just a demonstration testCase.
|
|
103 |
Double click on the TestCase class or open a TestRunner to see me checking...
|
|
104 |
- please add more methods like this..."
|
|
105 |
|
|
106 |
|history|
|
|
107 |
|
|
108 |
history := AbstractFileBrowser directoryHistoryClass new.
|
4025
|
109 |
history resetForwardBackward.
|
4348
|
110 |
self shouldnt: (history canBackward).
|
3953
|
111 |
history addToHistory:'1'.
|
4348
|
112 |
self shouldnt:(history canBackward).
|
3953
|
113 |
self shouldnt:(history canForward).
|
|
114 |
history addToHistory:'2'.
|
4348
|
115 |
self should:(history canBackward).
|
3953
|
116 |
history addToHistory:'3'.
|
4348
|
117 |
self should:(history canBackward).
|
3953
|
118 |
self shouldnt: (history canForward).
|
4348
|
119 |
self should: ((history goBackward) = '2').
|
|
120 |
self should: ((history goBackward) = '1').
|
3953
|
121 |
self should: (history canForward).
|
4348
|
122 |
self should: ((history goForward) = '2').
|
4025
|
123 |
self should: (history canForward).
|
3953
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
"
|
|
128 |
self run:#testDirectoryHistory
|
|
129 |
"
|
|
130 |
!
|
|
131 |
|
4623
|
132 |
testDosFiles
|
|
133 |
|
|
134 |
| file stream|
|
|
135 |
|
|
136 |
file := Filename currentDirectory asAbsoluteFilename construct:'foobar~1'.
|
|
137 |
stream := file writeStream.
|
|
138 |
self should:file exists.
|
|
139 |
stream close.
|
|
140 |
file remove.
|
|
141 |
|
|
142 |
"
|
|
143 |
self new testDosFiles
|
|
144 |
"
|
|
145 |
!
|
|
146 |
|
3892
|
147 |
testFileItem
|
|
148 |
"Just a demonstration testCase.
|
|
149 |
Double click on the TestCase class or open a TestRunner to see me checking...
|
|
150 |
- please add more methods like this..."
|
|
151 |
|
|
152 |
| file item|
|
|
153 |
|
|
154 |
file := Filename homeDirectory construct:'work/stx/doc/online/english/index.html'.
|
|
155 |
file exists ifTrue:[
|
4025
|
156 |
item := DirectoryContentsBrowser itemClass fileName:file.
|
3892
|
157 |
self should:(item mimeType = 'text/html').
|
|
158 |
].
|
|
159 |
|
|
160 |
"
|
|
161 |
self run:#testFileItem
|
|
162 |
"
|
|
163 |
!
|
|
164 |
|
|
165 |
testHardLink
|
|
166 |
"Just a demonstration testCase.
|
|
167 |
Double click on the TestCase class or open a TestRunner to see me checking...
|
|
168 |
- please add more methods like this..."
|
|
169 |
|
|
170 |
|browser|
|
|
171 |
|
|
172 |
browser := FileBrowserV2 new.
|
|
173 |
|
|
174 |
self should: ( browser isKindOf:AbstractFileBrowser ).
|
|
175 |
self should: ( browser respondsTo:#newHardLink ).
|
|
176 |
|
|
177 |
"/ self should: [ o at:0 ] raise:Error.
|
|
178 |
|
|
179 |
"
|
|
180 |
self run:#testHardLink
|
|
181 |
"
|
|
182 |
! !
|
|
183 |
|
|
184 |
!FileBrowserV2Tests class methodsFor:'documentation'!
|
|
185 |
|
|
186 |
version
|
5228
|
187 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2Tests.st,v 1.9 2003-10-02 12:22:11 penk Exp $'
|
3892
|
188 |
! !
|