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