Closed GoogleCodeExporter closed 9 years ago
This issue is a tricky one, and I'm afraid to tell it would be complicated to
fix.
GWT comes with something called Overlay Types
(http://code.google.com/p/google-web-toolkit/wiki/OverlayTypes), basically
JavaScriptObject subclasses, which are possible to cast from one type to
another when it would have been impossible in Java because its strong typing
nature.
Supporting Overlay Type and JavaScriptObject.cast() instruction would be
possible, but will involves a lot of (very) low-level bytecode manipultation,
which Javassist (the current bytecode manipultation API used in gwt-test-utils)
will probably not be able to do.
We will have a lot of refactoring to do to introduce a lower-level API, such as
ASM, which is used in real GWT to do the Overlay types magic.
Such a refactor is in the public roadmap, but is not the priority, since users
are still waiting for Cell, RequestFactory and Editors support...
My advice would be to go back to GWTTestCase for such low-level GWT /
JavaScript tests, since you reach one of the current technical limitation of
gwt-test-utils, I'm so sorry :-(
Original comment by gael.laz...@gmail.com
on 28 Nov 2011 at 7:18
HI there,
the lastest 0.40-SNAPSHOT now provides support for overlay types !
The following test pass well now :
@Test
public void push() {
// Arrange
JavaScriptObject jso = JavaScriptObject.createObject();
JsArray<JavaScriptObject> array = JavaScriptObject.createArray().cast();
// Act
array.push(jso);
// Assert
assertThat(array.length()).isEqualTo(1);
assertThat(array.get(0)).isEqualTo(jso);
}
Before updating, you should read this page carefully :
http://code.google.com/p/gwt-test-utils/wiki/MigrationTo040
Could you please give it a try and post some feedback ? Thanks !
Original comment by gael.laz...@gmail.com
on 8 Jul 2012 at 1:10
Original issue reported on code.google.com by
external...@oxylane.com
on 28 Nov 2011 at 4:47