ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / contrib / imageCarousel / test / browser / imageCarousel.contribution.test.ts 467 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
import assert from 'assert' ;
import { URI } from '../../../../../base/common/uri.js' ;
import { VSBuffer } from '../../../../../base/common/buffer.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { TestInstantiationService } from '../../../../../platform/instantiation/test/common/instantiationServiceMock.js' ;
import { workbenchInstantiationService } from '../../../../test/browser/workbenchTestServices.js' ;
import { NullFilesConfigurationService, createFileStat } from '../../../../test/common/workbenchTestServices.js' ;
import IExplorerService
ExplorerItem
IFileService IFileStat IFileContent
IEditorService
ImageCarouselEditorInput
TestConfigurationService
INotificationService
IWorkspaceContextService
path
isFolder
fileService IFileService
configService TestConfigurationService
parent ExplorerItem
ExplorerItem
path
fileService
configService
NullFilesConfigurationService
parent
isFolder
disposables
instantiationService TestInstantiationService
configService TestConfigurationService
openedInputs input ImageCarouselEditorInput group
infoMessages
errorMessages
openedInputs
infoMessages
errorMessages
configService
instantiationService disposables
resolveMap Map IFileStat fileContents Map VSBuffer
instantiationService IFileService resource
stat resolveMap resource path
stat
stat
instantiationService IFileService resource
content fileContents resource path
content
resource value content IFileContent
items ExplorerItem
instantiationService IExplorerService
items
instantiationService IEditorService input _options group
input
openedInputs input group group
disposables input
instantiationService INotificationService message
infoMessages message
instantiationService INotificationService message
errorMessages message
fileService instantiationService IFileService
parent fileService configService
imageItem fileService configService parent
pngData VSBuffer
jpgData VSBuffer
txtData VSBuffer
resolveMap
resolveMap
resource isFile
resource isFile
resource isFile
resource isDirectory isFile
fileContents
fileContents pngData
fileContents jpgData
fileContents txtData
resolveMap fileContents
imageItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
input openedInputs input
assert input collection sections length
images input collection sections images
assert images length
assert images name
assert images name
assert input startIndex
fileService instantiationService IFileService
folderItem fileService configService
gifData VSBuffer
webpData VSBuffer
resolveMap
resolveMap
resource isFile
resource isFile
resource isFile
fileContents
fileContents gifData
fileContents webpData
resolveMap fileContents
folderItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
images openedInputs input collection sections images
assert images length
assert images name
assert images name
fileService instantiationService IFileService
img1 fileService configService
img2 fileService configService
txtFile fileService configService
pngData VSBuffer
svgData VSBuffer
resolveMap
fileContents
fileContents pngData
fileContents svgData
resolveMap fileContents
img1 img2 txtFile
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
images openedInputs input collection sections images
assert images length
assert images name
assert images name
pngData VSBuffer
jpgData VSBuffer
folderUri
resolveMap
resolveMap
folderUri
resource isFile
resource isFile
resource isFile
fileContents
fileContents pngData
fileContents jpgData
resolveMap fileContents
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler folderUri
assert openedInputs length
images openedInputs input collection sections images
assert images length
pngData VSBuffer
contextService instantiationService IWorkspaceContextService
wsRoot contextService folders uri
logoUri wsRoot
readmeUri wsRoot
resolveMap
resolveMap wsRoot path
wsRoot
resource logoUri isFile
resource readmeUri isFile
fileContents
fileContents logoUri path pngData
resolveMap fileContents
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
images openedInputs input collection sections images
assert images length
assert images name
folderUri
resolveMap
resolveMap
folderUri
resource isFile
resolveMap
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler folderUri
assert openedInputs length
assert infoMessages length
fileService instantiationService IFileService
folderItem fileService configService
resolveMap
resolveMap
resource isFile
resource isFile
resolveMap
folderItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
assert infoMessages length
fileService instantiationService IFileService
folderItem fileService configService
resolveMap
resolveMap
folderItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
assert errorMessages length
assert infoMessages length
folderUri
resolveMap
resolveMap
folderUri
resource isFile
resource isFile
readFileCallCount
resolveMap
instantiationService IFileService
readFileCallCount
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler folderUri
assert readFileCallCount
assert openedInputs length
images openedInputs input collection sections images
assert images length
assert images data
assert images uri
fileService instantiationService IFileService
folderItem fileService configService
resolveMap
resolveMap
resource isFile
resource isFile
resource isFile
resource isFile
resource isFile
resolveMap
folderItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
images openedInputs input collection sections images
assert images length
assert images name
assert images name
assert images name
assert images name
fileService instantiationService IFileService
parent fileService configService
videoItem fileService configService parent
resolveMap
resolveMap
resource isFile
resource isFile
resource isFile
resolveMap
videoItem
CommandsRegistry
command CommandsRegistry
assert command
instantiationService command handler
assert openedInputs length
input openedInputs input
images input collection sections images
assert images length
assert images name
assert images name
assert input startIndex
{
}
from
'../../../files/browser/files.js'
;
import
{
}
from
'../../../files/common/explorerModel.js'
;
import
{
,
,
}
from
'../../../../../platform/files/common/files.js'
;
import
{
,
MODAL_GROUP
}
from
'../../../../services/editor/common/editorService.js'
;
import
{
}
from
'../../browser/imageCarouselEditorInput.js'
;
import
{
}
from
'../../../../../platform/configuration/test/common/testConfigurationService.js'
;
import
{
}
from
'../../../../../platform/notification/common/notification.js'
;
import
{
}
from
'../../../../../platform/workspace/common/workspace.js'
;
import
'../../browser/imageCarousel.contribution.js'
;
function
createExplorerItem
(
:
string
,
:
boolean
,
:
,
:
,
?
:
,
)
:
{
return
new
ExplorerItem
(
URI
.
file
(
)
,
,
,
,
,
,
)
;
}
suite
(
'OpenImagesInCarouselFromExplorerAction'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
let
:
;
let
:
;
let
:
{
:
;
:
typeof
MODAL_GROUP
}
[
]
;
let
:
string
[
]
;
let
:
string
[
]
;
setup
(
(
)
=>
{
=
[
]
;
=
[
]
;
=
[
]
;
=
new
TestConfigurationService
(
)
;
=
workbenchInstantiationService
(
undefined
,
)
;
}
)
;
function
stubFileService
(
:
<
string
,
>
,
:
<
string
,
>
)
:
void
{
.
stub
(
,
'resolve'
,
async
(
:
URI
)
=>
{
const
=
.
get
(
.
)
;
if
(
!
)
{
throw
new
Error
(
` File not found: ${ resource. path} `
)
;
}
return
;
}
)
;
.
stub
(
,
'readFile'
,
async
(
:
URI
)
=>
{
const
=
.
get
(
.
)
;
if
(
!
)
{
throw
new
Error
(
` Cannot read: ${ resource. path} `
)
;
}
return
{
,
:
}
as
;
}
)
;
}
function
stubExplorerService
(
:
[
]
)
:
void
{
.
stub
(
,
{
getContext
:
(
)
=>
,
}
)
;
}
function
stubEditorService
(
)
:
void
{
.
stub
(
,
'openEditor'
,
async
(
:
unknown
,
:
unknown
,
:
unknown
)
=>
{
if
(
instanceof
ImageCarouselEditorInput
)
{
.
push
(
{
,
:
as
typeof
MODAL_GROUP
}
)
;
.
add
(
)
;
}
return
undefined
;
}
)
;
}
function
stubNotificationService
(
)
:
void
{
.
stub
(
,
'info'
,
(
:
string
)
=>
{
.
push
(
)
;
}
)
;
.
stub
(
,
'error'
,
(
:
string
)
=>
{
.
push
(
)
;
}
)
;
}
test
(
'single image file opens carousel with sibling images'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/images'
,
true
,
,
)
;
const
=
createExplorerItem
(
'/workspace/images/photo.png'
,
false
,
,
,
)
;
const
=
.
fromString
(
'fake-png'
)
;
const
=
.
fromString
(
'fake-jpg'
)
;
const
=
.
fromString
(
'text file'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/images'
,
createFileStat
(
URI
.
file
(
'/workspace/images'
)
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/images/photo.png'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/images/other.jpg'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/images/readme.txt'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/images/subfolder'
)
,
:
true
,
:
false
}
,
]
)
)
;
const
=
new
Map< string , VSBuffer>
(
)
;
.
set
(
'/workspace/images/photo.png'
,
)
;
.
set
(
'/workspace/images/other.jpg'
,
)
;
.
set
(
'/workspace/images/readme.txt'
,
)
;
stubFileService
(
,
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
,
'Command should be registered'
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
,
'Should open one editor'
)
;
const
=
[
0
]
.
;
.
strictEqual
(
.
.
.
,
1
)
;
const
=
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include 2 image siblings (png + jpg), not txt'
)
;
.
strictEqual
(
[
0
]
.
,
'other.jpg'
)
;
.
strictEqual
(
[
1
]
.
,
'photo.png'
)
;
.
strictEqual
(
.
,
1
)
;
}
)
;
test
(
'folder opens carousel with all contained images'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/images'
,
true
,
,
)
;
const
=
.
fromString
(
'fake-gif'
)
;
const
=
.
fromString
(
'fake-webp'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/images'
,
createFileStat
(
URI
.
file
(
'/workspace/images'
)
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/images/anim.gif'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/images/photo.webp'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/images/script.js'
)
,
:
true
}
,
]
)
)
;
const
=
new
Map< string , VSBuffer>
(
)
;
.
set
(
'/workspace/images/anim.gif'
,
)
;
.
set
(
'/workspace/images/photo.webp'
,
)
;
stubFileService
(
,
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include 2 images (gif + webp), not js'
)
;
.
strictEqual
(
[
0
]
.
,
'anim.gif'
)
;
.
strictEqual
(
[
1
]
.
,
'photo.webp'
)
;
}
)
;
test
(
'multiple selected images open in carousel'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/a.png'
,
false
,
,
)
;
const
=
createExplorerItem
(
'/workspace/b.svg'
,
false
,
,
)
;
const
=
createExplorerItem
(
'/workspace/notes.txt'
,
false
,
,
)
;
const
=
.
fromString
(
'fake-png'
)
;
const
=
.
fromString
(
'<svg></svg>'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
const
=
new
Map< string , VSBuffer>
(
)
;
.
set
(
'/workspace/a.png'
,
)
;
.
set
(
'/workspace/b.svg'
,
)
;
stubFileService
(
,
)
;
stubExplorerService
(
[
,
,
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include only image files'
)
;
.
strictEqual
(
[
0
]
.
,
'a.png'
)
;
.
strictEqual
(
[
1
]
.
,
'b.svg'
)
;
}
)
;
test
(
'empty selection with resource argument opens carousel from that folder'
,
async
(
)
=>
{
const
=
.
fromString
(
'fake-png'
)
;
const
=
.
fromString
(
'fake-jpg'
)
;
const
=
URI
.
file
(
'/workspace/photos'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/photos'
,
createFileStat
(
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/photos/sunset.png'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/photos/mountain.jpg'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/photos/notes.txt'
)
,
:
true
}
,
]
)
)
;
const
=
new
Map< string , VSBuffer>
(
)
;
.
set
(
'/workspace/photos/sunset.png'
,
)
;
.
set
(
'/workspace/photos/mountain.jpg'
,
)
;
stubFileService
(
,
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
,
)
;
.
strictEqual
(
.
,
1
,
'Should open carousel using resource argument fallback'
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include 2 images from the folder'
)
;
}
)
;
test
(
'empty selection without resource falls back to first workspace folder'
,
async
(
)
=>
{
const
=
.
fromString
(
'fake-png'
)
;
const
=
.
get
(
)
;
const
=
.
getWorkspace
(
)
.
[
0
]
.
;
const
=
URI
.
joinPath
(
,
'logo.png'
)
;
const
=
URI
.
joinPath
(
,
'readme.md'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
.
,
createFileStat
(
,
false
,
false
,
true
,
false
,
[
{
:
,
:
true
}
,
{
:
,
:
true
}
,
]
)
)
;
const
=
new
Map< string , VSBuffer>
(
)
;
.
set
(
.
,
)
;
stubFileService
(
,
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
,
'Should open carousel using workspace root fallback'
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
1
,
'Should include image from workspace root'
)
;
.
strictEqual
(
[
0
]
.
,
'logo.png'
)
;
}
)
;
test
(
'empty selection with no images shows notification'
,
async
(
)
=>
{
const
=
URI
.
file
(
'/workspace/docs'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/docs'
,
createFileStat
(
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/docs/readme.md'
)
,
:
true
}
,
]
)
)
;
stubFileService
(
,
new
Map
(
)
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
stubNotificationService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
,
)
;
.
strictEqual
(
.
,
0
,
'Should not open carousel when folder has no images'
)
;
.
strictEqual
(
.
,
1
,
'Should show notification'
)
;
}
)
;
test
(
'folder with no images shows notification'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/docs'
,
true
,
,
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/docs'
,
createFileStat
(
URI
.
file
(
'/workspace/docs'
)
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/docs/readme.md'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/docs/notes.txt'
)
,
:
true
}
,
]
)
)
;
stubFileService
(
,
new
Map
(
)
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
stubNotificationService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
0
,
'Should not open carousel when folder has no images'
)
;
.
strictEqual
(
.
,
1
,
'Should show notification about no images'
)
;
}
)
;
test
(
'folder read error shows error notification'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/restricted'
,
true
,
,
)
;
const
=
new
Map< string , IFileStat>
(
)
;
stubFileService
(
,
new
Map
(
)
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
stubNotificationService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
0
,
'Should not open carousel on folder read error'
)
;
.
strictEqual
(
.
,
1
,
'Should show error notification'
)
;
.
strictEqual
(
.
,
0
,
'Should not show info notification'
)
;
}
)
;
test
(
'images with URIs are passed lazily without reading file contents'
,
async
(
)
=>
{
const
=
URI
.
file
(
'/workspace/broken'
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/broken'
,
createFileStat
(
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/broken/corrupt.png'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/broken/missing.jpg'
)
,
:
true
}
,
]
)
)
;
let
=
0
;
stubFileService
(
,
new
Map
(
)
)
;
.
stub
(
,
'readFile'
,
async
(
)
=>
{
++
;
throw
new
Error
(
'readFile should not be called'
)
;
}
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
stubNotificationService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
,
)
;
.
strictEqual
(
,
0
,
'readFile should not be called during action'
)
;
.
strictEqual
(
.
,
1
,
'Should open carousel with lazy image entries'
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include 2 lazy image entries'
)
;
.
strictEqual
(
[
0
]
.
,
undefined
,
'Image data should not be loaded eagerly'
)
;
.
ok
(
[
0
]
.
,
'Image should have a URI for lazy loading'
)
;
}
)
;
test
(
'folder includes video files alongside images'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/media'
,
true
,
,
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/media'
,
createFileStat
(
URI
.
file
(
'/workspace/media'
)
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/media/clip.mp4'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/photo.png'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/demo.webm'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/intro.mov'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/readme.txt'
)
,
:
true
}
,
]
)
)
;
stubFileService
(
,
new
Map
(
)
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
)
;
const
=
[
0
]
.
.
.
[
0
]
.
;
.
strictEqual
(
.
,
4
,
'Should include mp4 + webm + mov + png, not txt'
)
;
.
strictEqual
(
[
0
]
.
,
'clip.mp4'
)
;
.
strictEqual
(
[
1
]
.
,
'demo.webm'
)
;
.
strictEqual
(
[
2
]
.
,
'intro.mov'
)
;
.
strictEqual
(
[
3
]
.
,
'photo.png'
)
;
}
)
;
test
(
'single video file opens carousel with sibling media'
,
async
(
)
=>
{
const
=
.
get
(
)
;
const
=
createExplorerItem
(
'/workspace/media'
,
true
,
,
)
;
const
=
createExplorerItem
(
'/workspace/media/clip.mp4'
,
false
,
,
,
)
;
const
=
new
Map< string , IFileStat>
(
)
;
.
set
(
'/workspace/media'
,
createFileStat
(
URI
.
file
(
'/workspace/media'
)
,
false
,
false
,
true
,
false
,
[
{
:
URI
.
file
(
'/workspace/media/clip.mp4'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/photo.png'
)
,
:
true
}
,
{
:
URI
.
file
(
'/workspace/media/notes.txt'
)
,
:
true
}
,
]
)
)
;
stubFileService
(
,
new
Map
(
)
)
;
stubExplorerService
(
[
]
)
;
stubEditorService
(
)
;
const
{
}
=
await
import
(
'../../../../../platform/commands/common/commands.js'
)
;
const
=
.
getCommand
(
'workbench.action.openImagesInCarousel'
)
;
.
ok
(
)
;
await
.
invokeFunction
(
.
)
;
.
strictEqual
(
.
,
1
)
;
const
=
[
0
]
.
;
const
=
.
.
[
0
]
.
;
.
strictEqual
(
.
,
2
,
'Should include mp4 + png siblings'
)
;
.
strictEqual
(
[
0
]
.
,
'clip.mp4'
)
;
.
strictEqual
(
[
1
]
.
,
'photo.png'
)
;
.
strictEqual
(
.
,
0
,
'Start index should point to the selected video'
)
;
}
)
;
}
)
;