|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
[HtmlUnit] SF.net SVN: htmlunit:[5130] trunk/htmlunit/srcRevision: 5130
http://htmlunit.svn.sourceforge.net/htmlunit/?rev=5130&view=rev Author: mguillem Date: 2009-10-29 11:45:32 +0000 (Thu, 29 Oct 2009) Log Message: ----------- JavaScript: MouseEvent.initMouseEvent and KeyboardEvent.initKeyEvent initialize metaKey Issue 2888366 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/changes/changes.xml 2009-10-29 11:45:32 UTC (rev 5130) @@ -6,6 +6,9 @@ <body> <release version="2.7" date="?" description="Bugfixes, initial IE8 support, HttpClient 4 migration"> + <action type="fix" dev="mguillem" issue="2888366"> + JavaScript: MouseEvent.initMouseEvent and KeyboardEvent.initKeyEvent initialize metaKey + </action> <action type="fix" dev="mguillem"> Fixed StringIndexOutOfBoundsException occurring when typing in a cloned text input or textarea node. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java 2009-10-29 11:45:32 UTC (rev 5130) @@ -433,7 +433,8 @@ setAltKey(altKey); setShiftKey(shiftKey); setKeyCode(keyCode); - charCode_ = charCode; + setMetaKey(metaKey); + charCode_ = 0; } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java 2009-10-29 11:45:32 UTC (rev 5130) @@ -79,9 +79,6 @@ /** The button code according to W3C (0: left button, 1: middle button, 2: right button). */ private int button_; - /** Whether or not the "meta" key was pressed during the firing of the event. */ - private boolean metaKey_; - /** * Used to build the prototype. */ @@ -107,12 +104,12 @@ setShiftKey(shiftKey); setCtrlKey(ctrlKey); setAltKey(altKey); + setMetaKey(false); if (button != BUTTON_LEFT && button != BUTTON_MIDDLE && button != BUTTON_RIGHT) { throw new IllegalArgumentException("Invalid button code: " + button); } button_ = button; - metaKey_ = false; if (TYPE_DBL_CLICK.equals(type)) { setDetail(2); @@ -208,14 +205,6 @@ } /** - * Returns whether or not the "meta" key was pressed during the event firing. - * @return whether or not the "meta" key was pressed during the event firing - */ - public boolean jsxGet_metaKey() { - return metaKey_; - } - - /** * Special for FF (old stuff from Netscape time). * @see <a href="http://unixpapa.com/js/mouse.html">Javascript Madness: Mouse Events</a> * @return the button code @@ -267,7 +256,7 @@ setCtrlKey(ctrlKey); setAltKey(altKey); setShiftKey(shiftKey); - // Ignore the metaKey parameter; we don't support it yet. + setMetaKey(metaKey); button_ = button; // Ignore the relatedTarget parameter; we don't support it yet. } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java 2009-10-29 11:45:32 UTC (rev 5130) @@ -31,6 +31,9 @@ /** Specifies some detail information about the event. */ private long detail_; + /** Whether or not the "meta" key was pressed during the firing of the event. */ + private boolean metaKey_; + /** * Creates a new UI event instance. */ @@ -97,4 +100,19 @@ setDetail(detail); } + /** + * Returns whether or not the "meta" key was pressed during the event firing. + * @return whether or not the "meta" key was pressed during the event firing + */ + public boolean jsxGet_metaKey() { + return metaKey_; + } + + /** + * @param metaKey whether Meta has been pressed during this event or not + */ + protected void setMetaKey(final boolean metaKey) { + metaKey_ = metaKey; + } + } Modified: trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml =================================================================== --- trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml 2009-10-29 11:45:32 UTC (rev 5130) @@ -2358,9 +2358,6 @@ <property name="ctrlKey" readable="true" writable="false"> <browser name="Firefox"/> </property> - <property name="metaKey" readable="true" writable="false"> - <browser name="Firefox"/> - </property> <property name="pageX" readable="true" writable="false"> <browser name="Firefox"/> </property> @@ -2818,6 +2815,9 @@ <property name="detail" readable="true" writable="false"> <browser name="Firefox"/> </property> + <property name="metaKey" readable="true" writable="false"> + <browser name="Firefox"/> + </property> <property name="shiftKey" readable="true" writable="false"> <browser name="Firefox"/> </property> Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java 2009-10-29 11:45:32 UTC (rev 5130) @@ -67,4 +67,35 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(IE = "exception", + FF = { "keydown, true, true, true, true, true, true, 65, 0", + "keyup, false, false, false, false, false, false, 32, 0" }) + public void initKeyEvent() throws Exception { + final String html = "<html><head><script>\n" + + " var properties = ['type', 'bubbles', 'cancelable', /*'view',*/ 'ctrlKey', 'altKey',\n" + + " 'shiftKey', 'metaKey', 'keyCode', 'charCode'];\n" + + " function dumpEvent(e) {\n" + + " var str = '';\n" + + " for (var i=0; i<properties.length; ++i) str += ', ' + e[properties[i]];\n" + + " alert(str.substring(2));\n" + + " }\n" + + " function test() {\n" + + " try {\n" + + " var keyEvent = document.createEvent('KeyEvents');\n" + + " keyEvent.initKeyEvent('keydown', true, true, null, true, true, true, true, 65, 65);\n" + + " dumpEvent(keyEvent);\n" + + " keyEvent = document.createEvent('KeyEvents');\n" + + " keyEvent.initKeyEvent('keyup', false, false, null, false, false, false, false, 32, 32);\n" + + " dumpEvent(keyEvent);\n" + + " } catch(e) {alert('exception')}\n" + + " }\n" + + "</script></head><body onload='test()'>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java 2009-10-28 12:51:58 UTC (rev 5129) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java 2009-10-29 11:45:32 UTC (rev 5130) @@ -17,14 +17,14 @@ import static org.junit.Assert.assertNotNull; import java.net.URL; -import java.util.ArrayList; -import java.util.List; import org.junit.Test; +import org.junit.runner.RunWith; -import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.WebTestCase; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlTextArea; @@ -35,22 +35,18 @@ * @version $Revision$ * @author Marc Guillemot */ -public class MouseEventTest extends WebTestCase { +@RunWith(BrowserRunner.class) +public class MouseEventTest extends WebDriverTestCase { /** * @throws Exception if the test fails */ @Test public void testEventCoordinates() throws Exception { - testEventCoordinates(BrowserVersion.FIREFOX_2); - testEventCoordinates(BrowserVersion.INTERNET_EXPLORER_6); - } - - private void testEventCoordinates(final BrowserVersion browser) throws Exception { final URL url = getClass().getClassLoader().getResource("event_coordinates.html"); assertNotNull(url); - final WebClient client = new WebClient(browser); + final WebClient client = getWebClient(); final HtmlPage page = client.getPage(url); assertEquals("Mouse Event coordinates", page.getTitleText()); @@ -77,8 +73,11 @@ * @throws Exception if an error occurs */ @Test + @Alerts(FF = { "click", "true", "true", "true", "1", "2", "3", "4", "true", "true", "true", "true" }, + IE = "exception") public void testInitMouseEvent() throws Exception { final String html = "<html><body><script>\n" + + "try {\n" + " var e = document.createEvent('MouseEvents');\n" + " e.initMouseEvent('click', true, true, window, 0, 1, 2, 3, 4, true, true, true, true, 0, null);\n" + " alert(e.type);\n" @@ -92,11 +91,11 @@ + " alert(e.ctrlKey);\n" + " alert(e.altKey);\n" + " alert(e.shiftKey);\n" + + " alert(e.metaKey);\n" + + "} catch(e) { alert('exception') }\n" + "</script></body></html>"; - final List<String> actual = new ArrayList<String>(); - loadPage(BrowserVersion.FIREFOX_2, html, actual); - final String[] expected = {"click", "true", "true", "true", "1", "2", "3", "4", "true", "true", "true"}; - assertEquals(expected, actual); + + loadPageWithAlerts2(html); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ HtmlUnit-develop mailing list HtmlUnit-develop@... https://lists.sourceforge.net/lists/listinfo/htmlunit-develop |
|
|
Re: [HtmlUnit] SF.net SVN: htmlunit:[5130] trunk/htmlunit/srcHey Marc,
Is it correct that charCode_ is always set to 0 in KeyboardEvent.jsxFunction_initKeyEvent()? We were using the value of the charCode parameter. Take care, Daniel
On Thu, Oct 29, 2009 at 6:45 AM, <mguillem@...> wrote: Revision: 5130 -- Daniel Gredler http://daniel.gredler.net/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ HtmlUnit-develop mailing list HtmlUnit-develop@... https://lists.sourceforge.net/lists/listinfo/htmlunit-develop |
|
|
Re: [HtmlUnit] SF.net SVN: htmlunit:[5130] trunk/htmlunit/srcHi Daniel,
I don't know if it should always be 0. While fixing 2888366 I've had the surprise to find that FF returned 0. If you find a case where it should not be 0 and can guess the logic behind it, please implement it ;-) Cheers, Marc. Daniel Gredler a écrit : > Hey Marc, > > Is it correct that charCode_ is always set to 0 in > KeyboardEvent.jsxFunction_initKeyEvent()? We were using the value of the > charCode parameter. > > Take care, > > Daniel > > > On Thu, Oct 29, 2009 at 6:45 AM, <mguillem@... > <mailto:mguillem@...>> wrote: > > Revision: 5130 > > http://htmlunit.svn.sourceforge.net/htmlunit/?rev=5130&view=rev > <http://htmlunit.svn.sourceforge.net/htmlunit/?rev=5130&view=rev> > Author: mguillem > Date: 2009-10-29 11:45:32 +0000 (Thu, 29 Oct 2009) > > Log Message: > ----------- > JavaScript: MouseEvent.initMouseEvent and KeyboardEvent.initKeyEvent > initialize metaKey > > Issue 2888366 > > Modified Paths: > -------------- > trunk/htmlunit/src/changes/changes.xml > > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java > > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java > > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java > > trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml > > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java > > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java > > Modified: trunk/htmlunit/src/changes/changes.xml > =================================================================== > --- trunk/htmlunit/src/changes/changes.xml 2009-10-28 12:51:58 > UTC (rev 5129) > +++ trunk/htmlunit/src/changes/changes.xml 2009-10-29 11:45:32 > UTC (rev 5130) > @@ -6,6 +6,9 @@ > > <body> > <release version="2.7" date="?" description="Bugfixes, > initial IE8 support, HttpClient 4 migration"> > + <action type="fix" dev="mguillem" issue="2888366"> > + JavaScript: MouseEvent.initMouseEvent and > KeyboardEvent.initKeyEvent initialize metaKey > + </action> > <action type="fix" dev="mguillem"> > Fixed StringIndexOutOfBoundsException occurring when > typing in a cloned text input or textarea node. > </action> > > Modified: > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java > =================================================================== > --- > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -433,7 +433,8 @@ > setAltKey(altKey); > setShiftKey(shiftKey); > setKeyCode(keyCode); > - charCode_ = charCode; > + setMetaKey(metaKey); > + charCode_ = 0; > } > > /** > > Modified: > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java > =================================================================== > --- > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -79,9 +79,6 @@ > /** The button code according to W3C (0: left button, 1: middle > button, 2: right button). */ > private int button_; > > - /** Whether or not the "meta" key was pressed during the firing > of the event. */ > - private boolean metaKey_; > - > /** > * Used to build the prototype. > */ > @@ -107,12 +104,12 @@ > setShiftKey(shiftKey); > setCtrlKey(ctrlKey); > setAltKey(altKey); > + setMetaKey(false); > > if (button != BUTTON_LEFT && button != BUTTON_MIDDLE && > button != BUTTON_RIGHT) { > throw new IllegalArgumentException("Invalid button code: > " + button); > } > button_ = button; > - metaKey_ = false; > > if (TYPE_DBL_CLICK.equals(type)) { > setDetail(2); > @@ -208,14 +205,6 @@ > } > > /** > - * Returns whether or not the "meta" key was pressed during the > event firing. > - * @return whether or not the "meta" key was pressed during the > event firing > - */ > - public boolean jsxGet_metaKey() { > - return metaKey_; > - } > - > - /** > * Special for FF (old stuff from Netscape time). > * @see <a href="http://unixpapa.com/js/mouse.html">Javascript > Madness: Mouse Events</a> > * @return the button code > @@ -267,7 +256,7 @@ > setCtrlKey(ctrlKey); > setAltKey(altKey); > setShiftKey(shiftKey); > - // Ignore the metaKey parameter; we don't support it yet. > + setMetaKey(metaKey); > button_ = button; > // Ignore the relatedTarget parameter; we don't support it yet. > } > > Modified: > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java > =================================================================== > --- > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -31,6 +31,9 @@ > /** Specifies some detail information about the event. */ > private long detail_; > > + /** Whether or not the "meta" key was pressed during the firing > of the event. */ > + private boolean metaKey_; > + > /** > * Creates a new UI event instance. > */ > @@ -97,4 +100,19 @@ > setDetail(detail); > } > > + /** > + * Returns whether or not the "meta" key was pressed during the > event firing. > + * @return whether or not the "meta" key was pressed during the > event firing > + */ > + public boolean jsxGet_metaKey() { > + return metaKey_; > + } > + > + /** > + * @param metaKey whether Meta has been pressed during this > event or not > + */ > + protected void setMetaKey(final boolean metaKey) { > + metaKey_ = metaKey; > + } > + > } > > Modified: > trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml > =================================================================== > --- > trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/main/resources/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.xml > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -2358,9 +2358,6 @@ > <property name="ctrlKey" readable="true" writable="false"> > <browser name="Firefox"/> > </property> > - <property name="metaKey" readable="true" writable="false"> > - <browser name="Firefox"/> > - </property> > <property name="pageX" readable="true" writable="false"> > <browser name="Firefox"/> > </property> > @@ -2818,6 +2815,9 @@ > <property name="detail" readable="true" writable="false"> > <browser name="Firefox"/> > </property> > + <property name="metaKey" readable="true" writable="false"> > + <browser name="Firefox"/> > + </property> > <property name="shiftKey" readable="true" writable="false"> > <browser name="Firefox"/> > </property> > > Modified: > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java > =================================================================== > --- > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEventTest.java > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -67,4 +67,35 @@ > + "</body></html>"; > loadPageWithAlerts2(html); > } > + > + /** > + * @throws Exception if the test fails > + */ > + @Test > + @Alerts(IE = "exception", > + FF = { "keydown, true, true, true, true, true, true, > 65, 0", > + "keyup, false, false, false, false, false, false, > 32, 0" }) > + public void initKeyEvent() throws Exception { > + final String html = "<html><head><script>\n" > + + " var properties = ['type', 'bubbles', 'cancelable', > /*'view',*/ 'ctrlKey', 'altKey',\n" > + + " 'shiftKey', 'metaKey', 'keyCode', > 'charCode'];\n" > + + " function dumpEvent(e) {\n" > + + " var str = '';\n" > + + " for (var i=0; i<properties.length; ++i) str += > ', ' + e[properties[i]];\n" > + + " alert(str.substring(2));\n" > + + " }\n" > + + " function test() {\n" > + + " try {\n" > + + " var keyEvent = > document.createEvent('KeyEvents');\n" > + + " keyEvent.initKeyEvent('keydown', true, true, > null, true, true, true, true, 65, 65);\n" > + + " dumpEvent(keyEvent);\n" > + + " keyEvent = document.createEvent('KeyEvents');\n" > + + " keyEvent.initKeyEvent('keyup', false, false, > null, false, false, false, false, 32, 32);\n" > + + " dumpEvent(keyEvent);\n" > + + " } catch(e) {alert('exception')}\n" > + + " }\n" > + + "</script></head><body onload='test()'>\n" > + + "</body></html>"; > + loadPageWithAlerts2(html); > + } > } > > Modified: > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java > =================================================================== > --- > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java > 2009-10-28 12:51:58 UTC (rev 5129) > +++ > trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEventTest.java > 2009-10-29 11:45:32 UTC (rev 5130) > @@ -17,14 +17,14 @@ > import static org.junit.Assert.assertNotNull; > > import java.net.URL; > -import java.util.ArrayList; > -import java.util.List; > > import org.junit.Test; > +import org.junit.runner.RunWith; > > -import com.gargoylesoftware.htmlunit.BrowserVersion; > +import com.gargoylesoftware.htmlunit.BrowserRunner; > import com.gargoylesoftware.htmlunit.WebClient; > -import com.gargoylesoftware.htmlunit.WebTestCase; > +import com.gargoylesoftware.htmlunit.WebDriverTestCase; > +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; > import com.gargoylesoftware.htmlunit.html.HtmlElement; > import com.gargoylesoftware.htmlunit.html.HtmlPage; > import com.gargoylesoftware.htmlunit.html.HtmlTextArea; > @@ -35,22 +35,18 @@ > * @version $Revision$ > * @author Marc Guillemot > */ > -public class MouseEventTest extends WebTestCase { > +@RunWith(BrowserRunner.class) > +public class MouseEventTest extends WebDriverTestCase { > > /** > * @throws Exception if the test fails > */ > @Test > public void testEventCoordinates() throws Exception { > - testEventCoordinates(BrowserVersion.FIREFOX_2); > - testEventCoordinates(BrowserVersion.INTERNET_EXPLORER_6); > - } > - > - private void testEventCoordinates(final BrowserVersion browser) > throws Exception { > final URL url = > getClass().getClassLoader().getResource("event_coordinates.html"); > assertNotNull(url); > > - final WebClient client = new WebClient(browser); > + final WebClient client = getWebClient(); > final HtmlPage page = client.getPage(url); > assertEquals("Mouse Event coordinates", page.getTitleText()); > > @@ -77,8 +73,11 @@ > * @throws Exception if an error occurs > */ > @Test > + @Alerts(FF = { "click", "true", "true", "true", "1", "2", "3", > "4", "true", "true", "true", "true" }, > + IE = "exception") > public void testInitMouseEvent() throws Exception { > final String html = "<html><body><script>\n" > + + "try {\n" > + " var e = document.createEvent('MouseEvents');\n" > + " e.initMouseEvent('click', true, true, window, 0, 1, > 2, 3, 4, true, true, true, true, 0, null);\n" > + " alert(e.type);\n" > @@ -92,11 +91,11 @@ > + " alert(e.ctrlKey);\n" > + " alert(e.altKey);\n" > + " alert(e.shiftKey);\n" > + + " alert(e.metaKey);\n" > + + "} catch(e) { alert('exception') }\n" > + "</script></body></html>"; > - final List<String> actual = new ArrayList<String>(); > - loadPage(BrowserVersion.FIREFOX_2, html, actual); > - final String[] expected = {"click", "true", "true", "true", > "1", "2", "3", "4", "true", "true", "true"}; > - assertEquals(expected, actual); > + > + loadPageWithAlerts2(html); > } > > } > > > This was sent by the SourceForge.net collaborative development > platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > HtmlUnit-develop mailing list > HtmlUnit-develop@... > <mailto:HtmlUnit-develop@...> > https://lists.sourceforge.net/lists/listinfo/htmlunit-develop > > > > > -- > Daniel Gredler > http://daniel.gredler.net/ > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > ------------------------------------------------------------------------ > > _______________________________________________ > HtmlUnit-develop mailing list > HtmlUnit-develop@... > https://lists.sourceforge.net/lists/listinfo/htmlunit-develop ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ HtmlUnit-develop mailing list HtmlUnit-develop@... https://lists.sourceforge.net/lists/listinfo/htmlunit-develop |
|
|
Re: [HtmlUnit] SF.net SVN: htmlunit:[5130] trunk/htmlunit/srcCool, I just wanted to make sure that it wasn't a typo, or maybe something you had added temporarily for debugging purposes. Thanks!
On Wed, Nov 4, 2009 at 2:29 AM, Marc Guillemot <mguillemot@...> wrote: Hi Daniel, -- Daniel Gredler http://daniel.gredler.net/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ HtmlUnit-develop mailing list HtmlUnit-develop@... https://lists.sourceforge.net/lists/listinfo/htmlunit-develop |
| Free embeddable forum powered by Nabble | Forum Help |