public void testEffectsShouldBeQueued() {
$(e).html("<p id='idtest'>Content 1</p></p>");
final GQuery g = $("#idtest").css("position", "absolute");
final Offset o = g.offset();
final int duration = 1000;
g.as(Effects).
animate($$("left: '+=100'"), duration, EasingCurve.linear).
animate($$("top: '+=100'"), duration, EasingCurve.linear).
animate($$("left: '-=100'"), duration, EasingCurve.linear).
animate($$("top: '-=100'"), duration, EasingCurve.linear);
// Configure the max duration for this test
delayTestFinish(duration * 4);
// each timer calls the next one
final Timer timer1 = new Timer() {
public void run() {
assertPosition(g, o.add(0, 99), o.add(0, 1));
// Last timer should finish the test
finishTest();
}
};
final Timer timer2 = new Timer() {
public void run() {
assertPosition(g, o.add(99, 100), o.add(1, 100));
timer1.schedule(duration);
}
};
final Timer timer3 = new Timer() {
public void run() {
assertPosition(g, o.add(100, 1), o.add(100, 99));
timer2.schedule(duration);
}
};
final Timer timer4 = new Timer() {
public void run() {
assertPosition(g, o.add(1, 0), o.add(99, 0));
timer3.schedule(duration);
}
};
// Start the first timer
timer4.schedule(duration/2);