Please contact the HtmlUnit team for this - they are indeed in the business
of emulating real browsers and want to know about things like this so they
can fix them (in my experience).

kathrin

On Wed, Sep 9, 2009 at 2:53 PM, Ray Ryan <[email protected]> wrote:

>
>
> On Wed, Sep 9, 2009 at 11:42 AM, Frank Lin <[email protected]> wrote:
>
>>
>>
>> On Wed, Sep 9, 2009 at 11:19 AM, <[email protected]> wrote:
>>
>>> On Wed, Sep 9, 2009 at 10:53 AM, Frank Lin <[email protected]> wrote:
>>>
>>>> I would argue that is also our code to fix. In Style.java, we
>>>> implicitly change an int to a double. So in the case, 42 was changed
>>>> to 42.0 and we were relied on browser to correct it for us. In the
>>>> case of passing a real double 42.1, the fix will not convert it to
>>>> int, it sill be passing as 42.1.
>>>>
>>>
>>> Your change isn't fixing anything in the scenario you describe.
>>>
>>> If the user is calling setPropertyPx, we'll only accept an int, so 42.1
>>> is already coerced to an int. No bug.
>>>
>>
>> This will be a bug:
>>
>> If not code chagne,
>>
>> This test will fail in real browser:
>> div.getStyle().setPropertyPx("width", 42.1);
>> assertEquals("42.1px", div.getStyle().getProperty("width"));
>> Real browser will convert 42.1 to 42.
>> Htmlunit will pass though.
>>
>
> So it's a bug in HtmlUnit. It's not emulating the browser.
>
>>
>> This test will fail in Htmlunit:
>> div.getStyle().setPropertyPx("width", 42);
>> assertEquals("42px", div.getStyle().getProperty("width"));
>> Real browser passed (convert 42.0 to 42)
>> Htmlunit failed since 42.0, which cause by us.
>>
>
> How is this caused by us? HtmlUnit is in the business of emulating what the
> real browser does, and it's failing to do so. Under the hood the javascript
> for this test is something like:
>
> div.style["width"] = "42.0px";
> assertEquals("42px", div.style["width"])
>
> If this were a JsUnit test, it would pass in a real browser and fail in
> HTMLUnit.
>
> This is not a GWT bug, and before we contort our public api to work around
> it we should at least try to fix the real problem.
>
>
>>
>>
>> With code chage, it will pass for both real browser and Htmlunit;
>> confirmed with removing Htmlunit annotation:
>>
>> div.getStyle().setPropertyPx("width", 42.1);
>> assertEquals("42.1px", div.getStyle().getProperty("width"));
>>
>> div.getStyle().setPropertyPx("width", 42);
>> assertEquals("42px", div.getStyle().getProperty("width"));
>>
>>
>>
>>>
>>> If the user happens to call setProperty("border-width", 42.1, Unit.PX),
>>> your new int method won't be called.
>>>
>>>
>>> http://gwt-code-reviews.appspot.com/66801
>>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to