Hi,

CanvasRenderingContext2D.java indeed needs to be extended as you propose and the function need to be declared in JavaScriptConfiguration.xml.

If you submit a patch, it can be applied very quickly.

Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com

Anze wrote:
Hi Ahmed!

Thanks for the fast response, I really appreciate it!

It looks like the library needs functions scale(x,y) and translate(x,y) (I have added them dynamically, through JS, and the tests started working).

So i guess this should be added to host/canvas/CanvasRenderingContext2D.java:
-----
/**
* Scale the user coordinate system of the canvas
* @param x the x
* @param y the y
*/
public void jsxFunction_scale(final double x, final double y) {
    //empty
}

/**
* Translate the user coordinate system of the canvas
* @param x the x
* @param y the y
*/
public void jsxFunction_translate(final double x, final double y) {
    //empty
}
-----

Any chance someone could add this to trunk?

Also, how about adding full CanvasRenderingContext2D support? I can make the stubs if it helps... The list is here: (for instance)
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/WebKitDOMRef/CanvasRenderingContext2D_idl/Classes/CanvasRenderingContext2D/index.html

Thanks!

Anze


On Friday 12 February 2010, Ahmed Ashour wrote:
Hi Anze,

Regarding "Cannot find function scale in object [object
 CanvasRenderingContext2D]", this can be easily fixed in HtmlUnit be empty
 implementation.

Please have a look in the current implementation [1] and list all functions
 you need to skip.

[1]
 http://htmlunit.svn.sf.net/viewvc/htmlunit/trunk/htmlunit/src/main/java/co
m/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D
.java?view=markup#l_22

Yours,
Ahmed
----
Blog: http://asashour.blogspot.com

________________________________
From: Anze <[email protected]>
To: [email protected]
Sent: Fri, February 12, 2010 1:14:31 PM
Subject: [Webtest] Prototype AJAX

Hi all!

We are starting out with WebTest and would appreciate some help... :)

1) we are making AJAX calls and found that you had to use <sleep> to wait
 for the call to finish. Now, this is awkward - why would someone ever want
 to do something in a test before AJAX finished? Is there any wait to say
 "wait for all AJAX to finish"?

2) we are using Flotr library for drawing graphs. However, it doesn't play
nicely with WebTest:
TypeError: Cannot find function scale in object [object
CanvasRenderingContext2D].
Since we do not intend to test Flotr charts at this point, we would like
WebTest to skip Flotr.draw() JS function. The only way I can think of is to
set a cookie in test files and then check for cookie before calling
Flotr.draw. Is there a nicer way to do it?
Of course, tips on how to fix JS support for Flotr would be even better...
 :)

Thanks,

Anze
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to