source: Dev/trunk/src/client/dojox/fx/tests/_base.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.3 KB
Line 
1dojo.provide("dojox.fx.tests._base");
2
3dojo.require("dojox.fx._core");
4dojo.require("dojox.fx");
5
6tests.register("dojox.fx.tests._base", [
7
8        function simpleLineTest(t){
9
10                var line = new dojox.fx._Line(
11                        [0, 100],
12                        [100, 0]
13                );
14
15                var first = line.getValue(0);
16                t.assertEqual(first[0], 0);
17                t.assertEqual(first[1], 100);
18               
19                var mid = line.getValue(0.5);
20                t.assertEqual(mid[0], 50);
21                t.assertEqual(mid[1], 50);
22               
23                var end = line.getValue(1);
24                t.assertEqual(end[0], 100);
25                t.assertEqual(end[1], 0);
26
27        },
28       
29        function singleLineTest(t){
30               
31                var line = new dojox.fx._Line(0,100);
32                t.assertEqual(line.getValue(0), 0);
33                t.assertEqual(line.getValue(0.5), 50);
34                t.assertEqual(line.getValue(1), 100);
35               
36        },
37       
38        function multiDimensionalTest(t){
39               
40                var startSet = [5, 10, 15, 20, 25, 30, 35];
41                var endSet = [35, 30, 25, 20, 15, 10, 5];
42                               
43                var line = new dojox.fx._Line(startSet, endSet);
44               
45                var start = line.getValue(0);
46                var mid = line.getValue(0.5);
47                var end = line.getValue(1);
48               
49                t.assertEqual(start.length, 7);
50                t.assertEqual(end.length, 7);
51               
52                t.assertEqual(startSet[0], start[0]);
53                t.assertEqual(startSet[1], start[1]);
54                t.assertEqual(startSet[5], start[5]);
55               
56                var expectedMid = 20;
57                dojo.forEach(line.getValue(0.5), function(val, i){
58                        t.assertEqual(expectedMid, val)
59                });
60               
61        }
62       
63]);
Note: See TracBrowser for help on using the repository browser.