Merge branch 'master' into history
[potlatch2.git] / tests / src / net / systemeD / halcyon / connection / NodeTest.as
1 package net.systemeD.halcyon.connection {
2
3     import org.flexunit.Assert;
4     import net.systemeD.halcyon.connection.Node;
5     import net.systemeD.halcyon.connection.UndoableAction;
6
7     [RunWith("org.mockito.integrations.flexunit4.MockitoClassRunner")]
8     public class NodeTest {
9
10       [Mock(type="net.systemeD.halcyon.connection.Connection", argsList="constructorArgs")]
11       public var connection:Connection;
12       public var constructorArgs:Array = ["name", "api", "policy"];
13     
14       [Test]
15       public function dummy():void {
16           Assert.assertEquals(10,10);
17       }
18
19       [Test]
20       public function newNode():void {
21           var n:Node = new Node(connection,1,1,{},true,5,10);
22           Assert.assertEquals(n.lat, 5);
23       }
24
25       [Test]
26       public function moveNode():void {
27           var n:Node = new Node(connection,1,1,{},true,5,10);
28           n.setLatLon(14,41, function(action:UndoableAction):void { action.doAction(); });
29           Assert.assertEquals(n.lat, 14);
30           Assert.assertEquals(n.lon, 41);
31       }
32
33       [Test]
34       public function within():void {
35           var n:Node = new Node(connection,1,1,{},true,5,10);
36           Assert.assertTrue(n.within(9,11,6,4));
37           Assert.assertFalse(n.within(9,11,1,2));
38           Assert.assertFalse(n.within(11,12,6,4));
39           n.remove(function(action:UndoableAction):void { action.doAction(); });
40           Assert.assertFalse(n.within(9,11,6,4));
41       }
42
43     }
44 }