|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 let cw; |
|
6 |
|
7 let createGroupItem = function () { |
|
8 let bounds = new cw.Rect(20, 20, 150, 150); |
|
9 let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true}); |
|
10 |
|
11 cw.UI.setActive(groupItem); |
|
12 gBrowser.loadOneTab('about:blank', {inBackground: true}); |
|
13 |
|
14 return groupItem; |
|
15 } |
|
16 |
|
17 let testVeryQuickDragAndDrop = function () { |
|
18 let sourceGroup = createGroupItem(); |
|
19 let targetGroup = cw.GroupItems.groupItems[0]; |
|
20 |
|
21 sourceGroup.pushAway(true); |
|
22 targetGroup.pushAway(true); |
|
23 |
|
24 let sourceTab = sourceGroup.getChild(0).container; |
|
25 EventUtils.synthesizeMouseAtCenter(sourceTab, {type: 'mousedown'}, cw); |
|
26 |
|
27 let targetTab = targetGroup.getChild(0).container; |
|
28 EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mousemove'}, cw); |
|
29 EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mouseup'}, cw); |
|
30 |
|
31 is(targetGroup.getChildren().length, 2, 'target group has two tabs'); |
|
32 is(cw.GroupItems.groupItems.length, 1, 'sourceGroup was closed'); |
|
33 isnot(cw.GroupItems.groupItems[0], sourceGroup, 'sourceGroup was closed'); |
|
34 |
|
35 targetGroup.getChild(0).close(); |
|
36 hideTabView(finish); |
|
37 } |
|
38 |
|
39 waitForExplicitFinish(); |
|
40 |
|
41 showTabView(function () { |
|
42 cw = TabView.getContentWindow(); |
|
43 afterAllTabsLoaded(testVeryQuickDragAndDrop); |
|
44 }); |
|
45 } |