use of org.gwtproject.timer.client.Timer in project gwtproject by treblereel.
the class HeaderPanelTest method testResizeHeader.
public void testResizeHeader() {
final HeaderPanel panel = createPanel();
panel.setSize("200px", "400px");
RootPanel.get().add(panel);
final Label header = new Label();
header.setSize("100%", "50px");
panel.setHeaderWidget(header);
final Label content = new Label();
content.setHeight("100%");
panel.setContentWidget(content);
final Label footer = new Label();
footer.setSize("100%", "50px");
panel.setFooterWidget(footer);
delayTestFinish(5000);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
assertEquals(300, content.getOffsetHeight());
// Resize the header.
header.setHeight("75px");
new Timer() {
@Override
public void run() {
assertEquals(275, content.getOffsetHeight());
RootPanel.get().remove(panel);
finishTest();
}
}.schedule(250);
;
}
});
}
use of org.gwtproject.timer.client.Timer in project gwtproject by treblereel.
the class NativeScrollbarTestBase method testSetScrollPosition.
public void testSetScrollPosition() {
// Add a scroll handler.
final TestScrollHandler handler = new TestScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
finish();
}
};
scrollbar.addScrollHandler(handler);
// Scroll to a new position.
setScrollSize(scrollbar, 500);
// Wait for the scroll size to take effect.
delayTestFinish(TEST_TIMEOUT);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
// Set the scroll position.
setScrollPosition(scrollbar, 100);
assertEquals(100, getScrollPosition(scrollbar));
assertEquals(0, getMinimumScrollPosition(scrollbar));
assertEquals(300, getMaximumScrollPosition(scrollbar));
// Wait for the scroll event.
new Timer() {
@Override
public void run() {
assertTrue(handler.isFinished());
finishTest();
}
}.schedule(SCROLL_EVENT_TIMEOUT);
}
});
}
use of org.gwtproject.timer.client.Timer in project gwtproject by treblereel.
the class NativeScrollbarTestBase method testSetScrollbarSizeFiresScrollEvent.
/**
* Test that changing the scrollbar size can affect the scroll position and
* fires a scroll event.
*/
public void testSetScrollbarSizeFiresScrollEvent() {
setScrollSize(scrollbar, 400);
assertEquals(400, getScrollSize(scrollbar));
// Wait for the scroll size to take effect.
delayTestFinish(TEST_TIMEOUT);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
// Scroll to position 100.
setScrollPosition(scrollbar, 100);
assertEquals(100, getScrollPosition(scrollbar));
// Wait for the scroll position to take effect.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
// Add a scroll handler.
final TestScrollHandler handler = new TestScrollHandler() {
@Override
public void onScroll(ScrollEvent event) {
finish();
}
};
scrollbar.addScrollHandler(handler);
// Reduce scroll size to smaller than the scrollbar size.
setScrollbarSize(scrollbar, "400px");
// Wait for the new scroll size to take effect.
new Timer() {
@Override
public void run() {
assertEquals(0, getScrollPosition(scrollbar));
assertTrue(handler.isFinished());
finishTest();
}
}.schedule(SCROLL_EVENT_TIMEOUT);
}
});
}
});
}
use of org.gwtproject.timer.client.Timer in project gwtproject by treblereel.
the class PopupTest method testDependantPopupPanel.
/**
* @see #testDependantPopupPanel()
*/
protected void testDependantPopupPanel(final PopupPanel primaryPopup) {
// Show the popup
primaryPopup.show();
// Hide the popup
new Timer() {
@Override
public void run() {
primaryPopup.hide();
}
}.schedule(1000);
delayTestFinish(5000);
// Give time for any errors to occur
new Timer() {
@Override
public void run() {
finishTest();
}
}.schedule(2000);
}
use of org.gwtproject.timer.client.Timer in project gwtproject by treblereel.
the class TabLayoutPanelTest method testTabLayout.
/**
* Tests that tabs actually line up properly (see issue 4447).
*/
public void testTabLayout() {
final TabLayoutPanel p = new TabLayoutPanel(2, Unit.EM);
RootPanel.get().add(p);
p.add(new Button("foo"), new Label("foo"));
p.add(new Button("bar"), new Label("bar"));
// Give the browser some time to layout
new Timer() {
@Override
public void run() {
assertEquals(p.getTabWidget(0).getElement().getOffsetTop(), p.getTabWidget(1).getElement().getOffsetTop());
finishTest();
}
}.schedule(100);
delayTestFinish(200);
}
Aggregations