[gjs] test: add tweener overwrite test
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] test: add tweener overwrite test
- Date: Tue, 27 Oct 2015 23:23:33 +0000 (UTC)
commit 461baa6fcf23830a001dafe9bec0f9d02e01e743
Author: Tommi Komulainen <tko litl com>
Date: Fri Oct 9 17:09:07 2009 +0100
test: add tweener overwrite test
https://bugzilla.gnome.org/show_bug.cgi?id=597927
installed-tests/js/testTweener.js | 74 +++++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/installed-tests/js/testTweener.js b/installed-tests/js/testTweener.js
index 0245b64..ac2f96b 100644
--- a/installed-tests/js/testTweener.js
+++ b/installed-tests/js/testTweener.js
@@ -409,6 +409,80 @@ function testSpecialPropertySplitter() {
}
}
+function testTweenerOverwriteBeforeStart() {
+ var object = {
+ a: 0,
+ b: 0,
+ c: 0,
+ d: 0
+ };
+
+ var startCount = 0;
+ var overwriteCount = 0;
+ var completeCount = 0;
+
+ var tweenA = { a: 10, b: 10, c: 10, d: 10, time: 0.1,
+ onStart: function() { startCount += 1; },
+ onOverwrite: function() { overwriteCount += 1; },
+ onComplete: function() { completeCount += 1; }
+ };
+ var tweenB = { a: 20, b: 20, c: 20, d: 20, time: 0.1,
+ onStart: function() { startCount += 1; },
+ onOverwrite: function() { overwriteCount += 1; },
+ onComplete: function() {
+ completeCount += 1;
+ Mainloop.quit('testTweenerOverwriteBeforeStart');
+ }
+ };
+
+ Tweener.addTween(object, tweenA);
+ Tweener.addTween(object, tweenB);
+
+ Mainloop.run('testTweenerOverwriteBeforeStart');
+
+ JSUnit.assertEquals(1, completeCount);
+ JSUnit.assertEquals(1, startCount);
+ JSUnit.assertEquals(4, overwriteCount); // FAIL, should be 1, not per property
+}
+
+function testTweenerOverwriteAfterStart() {
+ var object = {
+ a: 0,
+ b: 0,
+ c: 0,
+ d: 0
+ };
+
+ var startCount = 0;
+ var overwriteCount = 0;
+ var completeCount = 0;
+
+ var tweenA = { a: 10, b: 10, c: 10, d: 10, time: 0.1,
+ onStart: function() {
+ startCount += 1;
+ Tweener.addTween(object, tweenB);
+ },
+ onOverwrite: function() { overwriteCount += 1; },
+ onComplete: function() { completeCount += 1; }
+ };
+ var tweenB = { a: 20, b: 20, c: 20, d: 20, time: 0.1,
+ onStart: function() { startCount += 1; },
+ onOverwrite: function() { overwriteCount += 1; },
+ onComplete: function() {
+ completeCount += 1;
+ Mainloop.quit('testTweenerOverwriteAfterStart');
+ }
+ };
+
+ Tweener.addTween(object, tweenA);
+
+ Mainloop.run('testTweenerOverwriteAfterStart');
+
+ JSUnit.assertEquals(1, completeCount);
+ JSUnit.assertEquals(2, startCount);
+ JSUnit.assertEquals(4, overwriteCount); // FAIL, should be 1, not per property
+}
+
installFrameTicker();
JSUnit.gjstestRun(this, JSUnit.setUp, JSUnit.tearDown);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]