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 13 matching lines...) Expand all Loading... |
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 deltaX = 12.5; |
33 var deltaY = 14.9; | 33 var deltaY = 14.9; |
34 var deltaGranularity = 148.3; | 34 var startPositionX = 16.82; |
| 35 var startPositionY = 82.17; |
35 var velocityX = 23.7; | 36 var velocityX = 23.7; |
36 var velocityY = 2.5; | 37 var velocityY = 2.5; |
| 38 var isBeginning = true; |
37 var inInertialPhase = true; | 39 var inInertialPhase = true; |
38 var isBeginning = true; | |
39 var isEnding = true; | 40 var isEnding = true; |
40 var scrollState = new ScrollState(deltaX, deltaY, deltaGranularity, velocity
X, | 41 var shouldPropagate = false; |
41 velocityY, inInertialPhase, isBeginning, i
sEnding); | 42 var fromUserInput = true; |
| 43 var isDirectManipulation = true; |
| 44 var deltaGranularity = 148.3; |
| 45 var scrollState = new ScrollState(deltaX, deltaY, startPositionX, startPosit
ionY, |
| 46 velocityX, velocityY, isBeginning, inInert
ialPhase, |
| 47 isEnding, shouldPropagate, fromUserInput, |
| 48 isDirectManipulation, deltaGranularity); |
42 assert_equals(scrollState.deltaX, deltaX); | 49 assert_equals(scrollState.deltaX, deltaX); |
43 assert_equals(scrollState.deltaY, deltaY); | 50 assert_equals(scrollState.deltaY, deltaY); |
44 assert_equals(scrollState.deltaGranularity, deltaGranularity); | 51 assert_equals(scrollState.startPositionX, Math.floor(startPositionX)); |
| 52 assert_equals(scrollState.startPositionY, Math.floor(startPositionY)); |
45 assert_equals(scrollState.velocityX, velocityX); | 53 assert_equals(scrollState.velocityX, velocityX); |
46 assert_equals(scrollState.velocityY, velocityY); | 54 assert_equals(scrollState.velocityY, velocityY); |
| 55 assert_equals(scrollState.isBeginning, isBeginning); |
47 assert_equals(scrollState.inInertialPhase, inInertialPhase); | 56 assert_equals(scrollState.inInertialPhase, inInertialPhase); |
48 assert_equals(scrollState.isBeginning, isBeginning); | |
49 assert_equals(scrollState.isEnding, isEnding); | 57 assert_equals(scrollState.isEnding, isEnding); |
50 assert_equals(scrollState.fromUserInput, false); | 58 assert_equals(scrollState.shouldPropagate, shouldPropagate); |
51 assert_equals(scrollState.shouldPropagate, true); | 59 assert_equals(scrollState.fromUserInput, fromUserInput); |
| 60 assert_equals(scrollState.isDirectManipulation, isDirectManipulation); |
| 61 assert_equals(scrollState.deltaGranularity, deltaGranularity); |
52 }, "Constructor behaves correctly."); | 62 }, "Constructor behaves correctly."); |
53 | 63 |
54 test(function() { | 64 test(function() { |
55 var scrollState = new ScrollState(); | 65 var scrollState = new ScrollState(); |
56 scrollState.fromUserInput = true; | 66 scrollState.fromUserInput = true; |
57 assert_equals(scrollState.fromUserInput, false); | 67 assert_equals(scrollState.fromUserInput, false); |
58 }, "fromUserInput is read only"); | 68 }, "fromUserInput is read only"); |
59 } | 69 } |
60 </script> | 70 </script> |
61 </body> | 71 </body> |
62 </html> | 72 </html> |
OLD | NEW |