OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>ScrollState constructor behaves correctly</title> | 5 <title>ScrollState constructor behaves correctly</title> |
6 <script src="../../../resources/testharness.js"></script> | 6 <script src="../../../resources/testharness.js"></script> |
7 <script src="../../../resources/testharnessreport.js"></script> | 7 <script src="../../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
(...skipping 11 matching lines...) Expand all Loading... |
22 assert_equals(scrollState.velocityX, 0); | 22 assert_equals(scrollState.velocityX, 0); |
23 assert_equals(scrollState.velocityY, 0); | 23 assert_equals(scrollState.velocityY, 0); |
24 assert_equals(scrollState.inInertialPhase, false); | 24 assert_equals(scrollState.inInertialPhase, false); |
25 assert_equals(scrollState.isBeginning, false); | 25 assert_equals(scrollState.isBeginning, false); |
26 assert_equals(scrollState.isEnding, false); | 26 assert_equals(scrollState.isEnding, false); |
27 assert_equals(scrollState.fromUserInput, false); | 27 assert_equals(scrollState.fromUserInput, false); |
28 assert_equals(scrollState.shouldPropagate, true); | 28 assert_equals(scrollState.shouldPropagate, true); |
29 }, "Empty constructor behaves correctly."); | 29 }, "Empty constructor behaves correctly."); |
30 | 30 |
31 test(function() { | 31 test(function() { |
32 var deltaX = 12.5; | 32 var init = { |
33 var deltaY = 14.9; | 33 deltaX: 12.5, |
34 var deltaGranularity = 148.3; | 34 deltaY: 14.9, |
35 var velocityX = 23.7; | 35 startPositionX: 16.82, |
36 var velocityY = 2.5; | 36 startPositionY: 82.17, |
37 var inInertialPhase = true; | 37 velocityX: 23.7, |
38 var isBeginning = true; | 38 velocityY: 2.5, |
39 var isEnding = true; | 39 isBeginning: true, |
40 var scrollState = new ScrollState(deltaX, deltaY, deltaGranularity, velocity
X, | 40 isInInertialPhase: true, |
41 velocityY, inInertialPhase, isBeginning, i
sEnding); | 41 isEnding: true, |
42 assert_equals(scrollState.deltaX, deltaX); | 42 shouldPropagate: false, |
43 assert_equals(scrollState.deltaY, deltaY); | 43 fromUserInput: true, |
44 assert_equals(scrollState.deltaGranularity, deltaGranularity); | 44 isDirectManipulation: true, |
45 assert_equals(scrollState.velocityX, velocityX); | 45 deltaGranularity: 148.3 |
46 assert_equals(scrollState.velocityY, velocityY); | 46 }; |
47 assert_equals(scrollState.inInertialPhase, inInertialPhase); | 47 var scrollState = new ScrollState(init); |
48 assert_equals(scrollState.isBeginning, isBeginning); | 48 assert_equals(scrollState.deltaX, init.deltaX); |
49 assert_equals(scrollState.isEnding, isEnding); | 49 assert_equals(scrollState.deltaY, init.deltaY); |
50 assert_equals(scrollState.fromUserInput, false); | 50 assert_equals(scrollState.startPositionX, Math.floor(init.startPositionX)); |
51 assert_equals(scrollState.shouldPropagate, true); | 51 assert_equals(scrollState.startPositionY, Math.floor(init.startPositionY)); |
| 52 assert_equals(scrollState.velocityX, init.velocityX); |
| 53 assert_equals(scrollState.velocityY, init.velocityY); |
| 54 assert_equals(scrollState.isBeginning, init.isBeginning); |
| 55 assert_equals(scrollState.inInertialPhase, init.isInInertialPhase); |
| 56 assert_equals(scrollState.isEnding, init.isEnding); |
| 57 assert_equals(scrollState.shouldPropagate, init.shouldPropagate); |
| 58 assert_equals(scrollState.fromUserInput, init.fromUserInput); |
| 59 assert_equals(scrollState.isDirectManipulation, init.isDirectManipulation); |
| 60 assert_equals(scrollState.deltaGranularity, init.deltaGranularity); |
52 }, "Constructor behaves correctly."); | 61 }, "Constructor behaves correctly."); |
53 | 62 |
54 test(function() { | 63 test(function() { |
55 var scrollState = new ScrollState(); | 64 var scrollState = new ScrollState(); |
| 65 scrollState.isBeginning = true; |
| 66 assert_equals(scrollState.isBeginning, false); |
56 scrollState.fromUserInput = true; | 67 scrollState.fromUserInput = true; |
57 assert_equals(scrollState.fromUserInput, false); | 68 assert_equals(scrollState.fromUserInput, false); |
58 }, "fromUserInput is read only"); | 69 }, "attributes are read only"); |
59 } | 70 } |
60 </script> | 71 </script> |
61 </body> | 72 </body> |
62 </html> | 73 </html> |
OLD | NEW |