use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.
the class AnimationGwt2SchedulerTest method testRequestAnimationFrame.
// TODO(davido): doesn't work on htmlunit-2.19 (works in 2.18)
// Presumably because of: http://sourceforge.net/p/htmlunit/code/11004
@DoNotRunWith(Platform.HtmlUnitBug)
public void testRequestAnimationFrame() {
delayTestFinish(TEST_TIMEOUT);
final double startTime = Duration.currentTimeMillis();
DivElement element = Document.get().createDivElement();
scheduler.requestAnimationFrame(timestamp -> {
// Make sure timestamp is not a high-res timestamp (see issue 8570)
assertTrue(timestamp >= startTime);
finishTest();
}, element);
}
use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.
the class AttributeGwt2Test method testSetGetRemove_idrefValue.
public void testSetGetRemove_idrefValue() {
attribute5.set(div, Id.of("1"), Id.of("2"));
assertEquals("1 2", attribute5.get(div));
attribute5.remove(div);
assertEquals("", attribute5.get(div));
DivElement ref1 = createDiv();
ref1.setId("ref1");
DivElement ref2 = createDiv();
ref2.setId("ref2");
attribute5.set(div, Id.of(ref1), Id.of(ref2));
assertEquals("ref1 ref2", attribute5.get(div));
}
use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.
the class ImageTest method testWrapThenSetUrlAndVisibleRect.
/**
* Tests that wrapping an existing DOM element works if you call
* setUrlAndVisibleRect() on it.
*/
public void testWrapThenSetUrlAndVisibleRect() {
String uid = Document.get().createUniqueId();
DivElement div = Document.get().createDivElement();
div.setInnerHTML("<img id='" + uid + "' src='counting-backwards.png' width='16' height='16'>");
Document.get().getBody().appendChild(div);
final Image image = Image.wrap(Document.get().getElementById(uid));
assertEquals(0, image.getOriginLeft());
assertEquals(0, image.getOriginTop());
assertEquals(16, image.getWidth());
assertEquals(16, image.getHeight());
assertEquals("unclipped", getCurrentImageStateName(image));
image.setUrlAndVisibleRect("counting-forwards.png", 0, 16, 16, 16);
assertEquals(0, image.getOriginLeft());
assertEquals(16, image.getOriginTop());
assertEquals(16, image.getWidth());
assertEquals(16, image.getHeight());
assertEquals("clipped", getCurrentImageStateName(image));
}
use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.
the class LabelTest method createAttachedDivElement.
/**
* Create a div and attach it to the {@link RootPanel}.
*
* @return the new div
*/
protected Element createAttachedDivElement() {
DivElement elem = Document.get().createDivElement();
RootPanel.getBodyElement().appendChild(elem);
return elem;
}
use of org.gwtproject.dom.client.DivElement in project gwtproject by treblereel.
the class PopupTest method testAutoHidePartner.
public void testAutoHidePartner() {
final PopupPanel popup = new PopupPanel();
// Add a partner
DivElement partner0 = Document.get().createDivElement();
popup.addAutoHidePartner(partner0);
popup.addAutoHidePartner(Document.get().createDivElement());
// Remove a partner
popup.removeAutoHidePartner(partner0);
}
Aggregations