Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Buschtöns2011-01-21 17:04:22 +0000
committerTim Buschtöns2011-01-21 17:04:22 +0000
commit57d55ffb0dbe649bcbbcfe9fcce1cafa4fd30676 (patch)
tree9dee9a697f1836a5a80fbc668c3afb25655e21e4 /tests
parent501d36b671fa387f55636f10ee01aed4ca6c9a39 (diff)
downloadorg.eclipse.rap-57d55ffb0dbe649bcbbcfe9fcce1cafa4fd30676.tar.gz
org.eclipse.rap-57d55ffb0dbe649bcbbcfe9fcce1cafa4fd30676.tar.xz
org.eclipse.rap-57d55ffb0dbe649bcbbcfe9fcce1cafa4fd30676.zip
Fix for Bug 334101 - [Tree] DND with multiselection in tree viewers is broken
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js58
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js58
2 files changed, 114 insertions, 2 deletions
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
index 23daef9c6f..2b6992a209 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
@@ -20,7 +20,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.TreeTest", {
assertEquals( "tree", tree.getAppearance() );
tree.destroy();
},
-
+
testDefaultProperties : function() {
var tree = new org.eclipse.rwt.widgets.Tree();
assertEquals( "default", tree.getCursor() );
@@ -3112,6 +3112,62 @@ qx.Class.define( "org.eclipse.rwt.test.tests.TreeTest", {
tree.destroy();
},
+ testTreeMultiSelectionDrag : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var dndSupport = org.eclipse.rwt.DNDSupport.getInstance();
+ var tree = this._createDefaultTree();
+ tree.setHasMultiSelection( true );
+ var actions = [ "copy", "move", "alias" ];
+ dndSupport.registerDragSource( tree, actions );
+ dndSupport.setDragSourceTransferTypes( tree, [ "default" ] );
+ var child0 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ var child1 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ testUtil.flush();
+ testUtil.click( tree._rows[ 0 ] );
+ testUtil.ctrlClick( tree._rows[ 1 ] );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree._selectionTimestamp = null; // prevent double click detection
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mousedown" );
+ assertTrue( "child0 selected", tree.isItemSelected( child0 ) );
+ assertTrue( "child1 selected", tree.isItemSelected( child1 ) );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mouseup" );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "click" );
+ assertFalse( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree.destroy();
+ },
+
+ testTreeMultiSelectionDragMouseOut : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var dndSupport = org.eclipse.rwt.DNDSupport.getInstance();
+ var tree = this._createDefaultTree();
+ tree.setHasMultiSelection( true );
+ var actions = [ "copy", "move", "alias" ];
+ dndSupport.registerDragSource( tree, actions );
+ dndSupport.setDragSourceTransferTypes( tree, [ "default" ] );
+ var child0 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ var child1 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ testUtil.flush();
+ testUtil.click( tree._rows[ 0 ] );
+ testUtil.ctrlClick( tree._rows[ 1 ] );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree._selectionTimestamp = null; // prevent double click detection
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mousedown" );
+ testUtil.mouseOut( tree._rows[ 1 ] );
+ testUtil.mouseOut( tree );
+ testUtil.mouseOver( tree );
+ testUtil.mouseOver( tree._rows[ 1 ] );
+ assertTrue( "child0 selected", tree.isItemSelected( child0 ) );
+ assertTrue( "child1 selected", tree.isItemSelected( child1 ) );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mouseup" );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree.destroy();
+ },
+
+
/////////
// helper
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
index 23daef9c6f..2b6992a209 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/TreeTest.js
@@ -20,7 +20,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.TreeTest", {
assertEquals( "tree", tree.getAppearance() );
tree.destroy();
},
-
+
testDefaultProperties : function() {
var tree = new org.eclipse.rwt.widgets.Tree();
assertEquals( "default", tree.getCursor() );
@@ -3112,6 +3112,62 @@ qx.Class.define( "org.eclipse.rwt.test.tests.TreeTest", {
tree.destroy();
},
+ testTreeMultiSelectionDrag : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var dndSupport = org.eclipse.rwt.DNDSupport.getInstance();
+ var tree = this._createDefaultTree();
+ tree.setHasMultiSelection( true );
+ var actions = [ "copy", "move", "alias" ];
+ dndSupport.registerDragSource( tree, actions );
+ dndSupport.setDragSourceTransferTypes( tree, [ "default" ] );
+ var child0 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ var child1 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ testUtil.flush();
+ testUtil.click( tree._rows[ 0 ] );
+ testUtil.ctrlClick( tree._rows[ 1 ] );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree._selectionTimestamp = null; // prevent double click detection
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mousedown" );
+ assertTrue( "child0 selected", tree.isItemSelected( child0 ) );
+ assertTrue( "child1 selected", tree.isItemSelected( child1 ) );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mouseup" );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "click" );
+ assertFalse( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree.destroy();
+ },
+
+ testTreeMultiSelectionDragMouseOut : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var dndSupport = org.eclipse.rwt.DNDSupport.getInstance();
+ var tree = this._createDefaultTree();
+ tree.setHasMultiSelection( true );
+ var actions = [ "copy", "move", "alias" ];
+ dndSupport.registerDragSource( tree, actions );
+ dndSupport.setDragSourceTransferTypes( tree, [ "default" ] );
+ var child0 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ var child1 = new org.eclipse.rwt.widgets.TreeItem( tree );
+ testUtil.flush();
+ testUtil.click( tree._rows[ 0 ] );
+ testUtil.ctrlClick( tree._rows[ 1 ] );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree._selectionTimestamp = null; // prevent double click detection
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mousedown" );
+ testUtil.mouseOut( tree._rows[ 1 ] );
+ testUtil.mouseOut( tree );
+ testUtil.mouseOver( tree );
+ testUtil.mouseOver( tree._rows[ 1 ] );
+ assertTrue( "child0 selected", tree.isItemSelected( child0 ) );
+ assertTrue( "child1 selected", tree.isItemSelected( child1 ) );
+ testUtil.fakeMouseEvent( tree._rows[ 1 ], "mouseup" );
+ assertTrue( tree.isItemSelected( child0 ) );
+ assertTrue( tree.isItemSelected( child1 ) );
+ tree.destroy();
+ },
+
+
/////////
// helper

Back to the top