google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

Patcher for gwt.Tree #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi there,

as requested the issue for missing gwt.Tree-patcher :>
i have attached our ImageAdapterPatcher, maybe you can use it ;)
thx

=> c&p from my mail:
i have some tests involving the gwt.Tree...

after patching com.google.gwt.user.client.ui.Tree$ImageAdapter* and
adding "new TreeItemImpl()" to my gwtCreateHandler for
TreeItemImpl.class, there is another error :/

=>
java.lang.NullPointerException
       at com.google.gwt.user.client.DOM.clone(DOM.java:70)
       at com.google.gwt.user.client.ui.TreeItem.<init>(TreeItem.java:263)
       at com.google.gwt.user.client.ui.Tree$1.<init>(Tree.java:965)
       at com.google.gwt.user.client.ui.Tree.init(Tree.java:965)
       at com.google.gwt.user.client.ui.Tree.<init>(Tree.java:250)

lg kiiu

*in order to fix:
java.lang.IllegalArgumentException: URI is not hierarchical
           at java.io.File.<init>(Unknown Source)
           at com.octo.gwt.test.internal.patcher.tools.resources.ClientBundleProxyFactory
$ClientBundleMethodsRegistry.computeResourceFile(ClientBundleProxyFactory.java:1
62)
           at com.octo.gwt.test.internal.patcher.tools.resources.ClientBundleProxyFactory
$ClientBundleMethodsRegistry.getResourceFile(ClientBundleProxyFactory.java:
117)
           at com.octo.gwt.test.internal.patcher.tools.resources.ClientBundleProxyFactory$1.invoke(ClientBundleProxyFactory.java:61)
           at $Proxy13.treeClosed(Unknown Source)
           at com.google.gwt.user.client.ui.Tree$ImageAdapter.<init>(Tree.java:132)
           at com.google.gwt.user.client.ui.Tree.<init>(Tree.java:250)

Original issue reported on code.google.com by kiiu....@gmail.com on 10 Aug 2010 at 9:12

Attachments:

GoogleCodeExporter commented 9 years ago
I've just finish to handle GWT Tree. I didn't use your ImageAdapterPatcher 
because I prefer to patch Image correctly so it will work in most cases.

I deployed a new snapshot with the modification. The attached file show the 
unit tests I wrote to validate Tree is handle by gwt-test-utils.

Could you please check if everything is working for you and close the issue if 
it's ok ?

Thanks

Original comment by gael.laz...@gmail.com on 10 Aug 2010 at 9:56

Attachments:

GoogleCodeExporter commented 9 years ago
okay, i tested your modifications => they work for my tests ;)

but could you pls deprecate methods you are up to remove from future versions? 
:)
i had to modify your source to get it to work, because setGwtCreateHandler was 
missing and i didn't want to rebuild our test-libary that depends on 
gwt-test-utils
=> therefore i would have to integrate ivy, maven and our build and that is way 
to much :(

thx anyway - gwt-test-utils is great :>

Original comment by kiiu....@gmail.com on 10 Aug 2010 at 11:59

GoogleCodeExporter commented 9 years ago
I've just restaure the old setGwtCreateHandler method and set it @Deprecated.

I'm sorry for that.. You're not the only one who was using this method, so I 
will let it for a few weeks.

New snapshot has been deployed :-)

Thank you for your feedback !

Original comment by gael.laz...@gmail.com on 10 Aug 2010 at 12:19

GoogleCodeExporter commented 9 years ago
i would like to reopen this issue - but how? :/
because i have another one :p

java.lang.UnsatisfiedLinkError: 
com.google.gwt.dom.client.DOMImpl.scrollIntoView(Lcom/google/gwt/dom/client/Elem
ent;)V
    at com.google.gwt.dom.client.DOMImpl.scrollIntoView(Native Method)
    at com.google.gwt.dom.client.Element.scrollIntoView(Element.java:565)
    at com.google.gwt.user.client.DOM.scrollIntoView(DOM.java:1031)
    at com.google.gwt.user.client.ui.Tree.moveFocus(Tree.java:1076)
    at com.google.gwt.user.client.ui.Tree.onSelection(Tree.java:1187)
    at com.google.gwt.user.client.ui.Tree.setSelectedItem(Tree.java:697)
    at com.google.gwt.user.client.ui.Tree.setSelectedItem(Tree.java:677)

Original comment by kiiu....@gmail.com on 10 Aug 2010 at 12:47

GoogleCodeExporter commented 9 years ago
OK, I could reproduce this test, by calling setSelected(..) method on a 
TreeItem which wraps a FocusWidget.
The corresponding throw your exception :

@Test
    public void checkSelectedOnFocusWidget() {
        // Setup
        tree.addSelectionHandler(new SelectionHandler<TreeItem>() {

            public void onSelection(SelectionEvent<TreeItem> event) {
                clickedTreeItem = event.getSelectedItem();
            }
        });

        // Test on item2 which wrap a Checkbox
        tree.setSelectedItem(item2);
        TreeItem selected = tree.getSelectedItem();

        // Assert
        Assert.assertEquals(item2, clickedTreeItem);
        Assert.assertEquals(item2, selected);
    }

I'm getting it green right now

Original comment by gael.laz...@gmail.com on 10 Aug 2010 at 1:07

GoogleCodeExporter commented 9 years ago
The test pass after adding an empty patch method in DOMImplPatcher

@PatchMethod
public static void scrollIntoView(Object domImpl, Element elem) {

}

Since scrollIntoView has only visual concern, it's totally fine just removing 
the JSNI nature of the method which will do nothing running in our standard JVM 
:-)

I already deployed a new snapshot with this fix, thank your for checking it ;)

Original comment by gael.laz...@gmail.com on 10 Aug 2010 at 1:15

GoogleCodeExporter commented 9 years ago
works fine - thanks :>

Original comment by kiiu....@gmail.com on 10 Aug 2010 at 2:11

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 10 Aug 2010 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 9 Jun 2011 at 1:59