Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Buschtöns2011-02-02 16:11:16 +0000
committerTim Buschtöns2011-02-02 16:11:16 +0000
commit390a2bb1ce323b23980a9febdef25cd374b29a0a (patch)
tree77f4fc2384080bc793fdee0b3e653afeec2a9c0e /tests
parentdb7c8601da3f8bd2fb5e32562aac7274ad25626a (diff)
downloadorg.eclipse.rap-390a2bb1ce323b23980a9febdef25cd374b29a0a.tar.gz
org.eclipse.rap-390a2bb1ce323b23980a9febdef25cd374b29a0a.tar.xz
org.eclipse.rap-390a2bb1ce323b23980a9febdef25cd374b29a0a.zip
Widget.js/GraphicsMixin.js refactored for better integration, Widget formatted/cleaned-up for overview. See Bug 327023 - Refactor Widget.js for better Graphics and Animation integration
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js19
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js67
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js27
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js19
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js67
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js27
6 files changed, 198 insertions, 28 deletions
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
index 9435c9ce44..29f1233c94 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2010, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -172,6 +172,23 @@ qx.Class.define( "org.eclipse.rwt.test.tests.EventHandlerTest", {
"mshtml" : null
} ),
+// testMissingMouseUp : function() {
+// var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+// var widget = this.createDefaultWidget();
+// var targetNode = widget._getTargetNode();
+// var log = [];
+// var handler = function( event ) {
+// log.push( event.getType() );
+// };
+// widget.addEventListener( "mousedown", handler );
+// widget.addEventListener( "mouseup", handler );
+// widget.addEventListener( "mousemove", handler );
+// testUtil.fakeMouseEventDOM( targetNode, "mousedown" );
+// testUtil.fakeMouseEventDOM( targetNode, "mousemove", 0 );
+// assertEquals( [ "mousedown", "mouseup", "mousemove" ], log );
+// widget.destroy();
+// },
+//
testKeyDownCharCode : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var widget = new qx.ui.basic.Terminator();
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
index 44c356aab0..fdcb93da27 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -272,30 +272,73 @@ qx.Class.define( "org.eclipse.rwt.test.tests.GraphicsMixinTest", {
shell.destroy();
testUtil.flush();
},
-
- testOnCanvasAppear : function() {
+
+ testOnCanvasAppearOnWidgetInsert : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
+ widget1.addToDocument();
+ widget2.addToDocument();
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
+ widget2.setVisibility( false );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
+ widget1.destroy();
+ widget2.destroy();
+ },
+
+ testOnCanvasAppearOnSetDisplay : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
+ widget1.addToDocument();
+ widget2.addToDocument();
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
+ widget2.setVisibility( false );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
+ widget1.setDisplay( false );
+ widget2.setDisplay( false );
+ testUtil.flush();
+ widget1.setDisplay( true );
+ widget2.setDisplay( true );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2", "widget1", "widget2" ], log );
+ testUtil.flush();
+ },
+
+ testOnCanvasAppearOnEnhancedBorder : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var gfxUtil = org.eclipse.rwt.GraphicsUtil;
var shell = this._createShell();
- var widget1 = new qx.ui.basic.Terminator();
- var widget2 = new qx.ui.basic.Terminator();
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
widget1.setParent( shell );
widget2.setParent( shell );
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
widget2.setVisibility( false );
- widget1._gfxCanvasAppended = true;
- widget2._gfxCanvasAppended = true;
- widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
- widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
shell.setBackgroundColor( "green" );
shell.setBorder( this.gfxBorder );
testUtil.flush();
- assertEquals( [ "widget1" ], log );
+ assertEquals( [ "widget1", "widget2", "widget1", "widget2" ], log );
shell.destroy();
testUtil.flush();
},
-
+
testOpacityWidthEnhancedBorder : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var gfxUtil = org.eclipse.rwt.GraphicsUtil;
@@ -404,7 +447,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.GraphicsMixinTest", {
var result = new org.eclipse.swt.widgets.Shell();
result.addToDocument();
result.setBackgroundColor( null );
- result.open();
+ result.open();
qx.ui.core.Widget.flushGlobalQueues();
return result;
},
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
index 603ccc4c65..6b34f60bbd 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2010, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -99,6 +99,31 @@ qx.Class.define( "org.eclipse.rwt.test.tests.ProgressBarTest", {
bar.destroy();
qx.ui.core.Widget.flushGlobalQueues();
},
+
+
+ testOnCanvasAppearOnEnhancedBorder : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var gfxUtil = org.eclipse.rwt.GraphicsUtil;
+ var shell = new org.eclipse.swt.widgets.Shell();
+ shell.addToDocument();
+ shell.setBackgroundColor( null );
+ shell.open();
+ var log = [];
+ var bar = new org.eclipse.swt.widgets.ProgressBar();
+ bar._onCanvasAppear = function(){ log.push( "bar" ); };
+ bar.setDimension( 200, 30 );
+ bar.setBorder( this._gfxBorder );
+ bar.setSelection( 50 );
+ bar.setParent( shell );
+ testUtil.flush();
+ assertEquals( 1, log.length );
+ shell.setBackgroundColor( "green" );
+ shell.setBorder( new org.eclipse.rwt.RoundedBorder( 1, "black", 0 ) );
+ testUtil.flush();
+ assertEquals( 2, log.length );
+ shell.destroy();
+ testUtil.flush();
+ },
testRoundedBorderIndicatorMinLength : function() {
var gfxUtil = org.eclipse.rwt.GraphicsUtil;
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
index 9435c9ce44..29f1233c94 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/EventHandlerTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2010, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -172,6 +172,23 @@ qx.Class.define( "org.eclipse.rwt.test.tests.EventHandlerTest", {
"mshtml" : null
} ),
+// testMissingMouseUp : function() {
+// var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+// var widget = this.createDefaultWidget();
+// var targetNode = widget._getTargetNode();
+// var log = [];
+// var handler = function( event ) {
+// log.push( event.getType() );
+// };
+// widget.addEventListener( "mousedown", handler );
+// widget.addEventListener( "mouseup", handler );
+// widget.addEventListener( "mousemove", handler );
+// testUtil.fakeMouseEventDOM( targetNode, "mousedown" );
+// testUtil.fakeMouseEventDOM( targetNode, "mousemove", 0 );
+// assertEquals( [ "mousedown", "mouseup", "mousemove" ], log );
+// widget.destroy();
+// },
+//
testKeyDownCharCode : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var widget = new qx.ui.basic.Terminator();
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
index 44c356aab0..fdcb93da27 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/GraphicsMixinTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -272,30 +272,73 @@ qx.Class.define( "org.eclipse.rwt.test.tests.GraphicsMixinTest", {
shell.destroy();
testUtil.flush();
},
-
- testOnCanvasAppear : function() {
+
+ testOnCanvasAppearOnWidgetInsert : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
+ widget1.addToDocument();
+ widget2.addToDocument();
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
+ widget2.setVisibility( false );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
+ widget1.destroy();
+ widget2.destroy();
+ },
+
+ testOnCanvasAppearOnSetDisplay : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
+ widget1.addToDocument();
+ widget2.addToDocument();
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
+ widget2.setVisibility( false );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
+ widget1.setDisplay( false );
+ widget2.setDisplay( false );
+ testUtil.flush();
+ widget1.setDisplay( true );
+ widget2.setDisplay( true );
+ testUtil.flush();
+ assertEquals( [ "widget1", "widget2", "widget1", "widget2" ], log );
+ testUtil.flush();
+ },
+
+ testOnCanvasAppearOnEnhancedBorder : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var gfxUtil = org.eclipse.rwt.GraphicsUtil;
var shell = this._createShell();
- var widget1 = new qx.ui.basic.Terminator();
- var widget2 = new qx.ui.basic.Terminator();
+ var widget1 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
+ var widget2 = new org.eclipse.rwt.widgets.MultiCellWidget( [] );
var log = [];
+ widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
+ widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
widget1.setParent( shell );
widget2.setParent( shell );
+ widget1.setBorder( this.gfxBorder );
+ widget2.setBorder( this.gfxBorder );
widget2.setVisibility( false );
- widget1._gfxCanvasAppended = true;
- widget2._gfxCanvasAppended = true;
- widget1._onCanvasAppear = function(){ log.push( "widget1" ); };
- widget2._onCanvasAppear = function(){ log.push( "widget2" ); };
testUtil.flush();
+ assertEquals( [ "widget1", "widget2" ], log );
shell.setBackgroundColor( "green" );
shell.setBorder( this.gfxBorder );
testUtil.flush();
- assertEquals( [ "widget1" ], log );
+ assertEquals( [ "widget1", "widget2", "widget1", "widget2" ], log );
shell.destroy();
testUtil.flush();
},
-
+
testOpacityWidthEnhancedBorder : function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var gfxUtil = org.eclipse.rwt.GraphicsUtil;
@@ -404,7 +447,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.GraphicsMixinTest", {
var result = new org.eclipse.swt.widgets.Shell();
result.addToDocument();
result.setBackgroundColor( null );
- result.open();
+ result.open();
qx.ui.core.Widget.flushGlobalQueues();
return result;
},
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
index 603ccc4c65..6b34f60bbd 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ProgressBarTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 EclipseSource and others. All rights reserved.
+ * Copyright (c) 2010, 2011 EclipseSource and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -99,6 +99,31 @@ qx.Class.define( "org.eclipse.rwt.test.tests.ProgressBarTest", {
bar.destroy();
qx.ui.core.Widget.flushGlobalQueues();
},
+
+
+ testOnCanvasAppearOnEnhancedBorder : function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var gfxUtil = org.eclipse.rwt.GraphicsUtil;
+ var shell = new org.eclipse.swt.widgets.Shell();
+ shell.addToDocument();
+ shell.setBackgroundColor( null );
+ shell.open();
+ var log = [];
+ var bar = new org.eclipse.swt.widgets.ProgressBar();
+ bar._onCanvasAppear = function(){ log.push( "bar" ); };
+ bar.setDimension( 200, 30 );
+ bar.setBorder( this._gfxBorder );
+ bar.setSelection( 50 );
+ bar.setParent( shell );
+ testUtil.flush();
+ assertEquals( 1, log.length );
+ shell.setBackgroundColor( "green" );
+ shell.setBorder( new org.eclipse.rwt.RoundedBorder( 1, "black", 0 ) );
+ testUtil.flush();
+ assertEquals( 2, log.length );
+ shell.destroy();
+ testUtil.flush();
+ },
testRoundedBorderIndicatorMinLength : function() {
var gfxUtil = org.eclipse.rwt.GraphicsUtil;

Back to the top