forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmxModelTest.java
More file actions
68 lines (58 loc) · 1.42 KB
/
mxModelTest.java
File metadata and controls
68 lines (58 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Copyright (c) 2006, Gaudenz Alder
*/
package com.mxgraph.test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import com.mxgraph.model.mxIGraphModel;
import com.mxgraph.view.mxGraph;
public class mxModelTest extends TestCase
{
/**
* Constructs a new test case for the specified name.
*
* @param name
* The name of the test case to be constructed.
*/
public mxModelTest(String name)
{
super(name);
}
/**
*
*/
public void test1() throws Exception
{
// Creates graph with model
mxGraph graph = new mxGraph();
Object parent = graph.getDefaultParent();
Object v1, v2, e1;
graph.getModel().beginUpdate();
try
{
v1 = graph.insertVertex(parent, null, "Hello", 20, 20, 80, 30);
v2 = graph.insertVertex(parent, null, "World!", 200, 150, 80, 30);
e1 = graph.insertEdge(parent, null, "e1", v1, v2);
}
finally
{
graph.getModel().endUpdate();
}
mxIGraphModel model = graph.getModel();
assertEquals(model.getTerminal(e1, true), v1);
assertEquals(model.getTerminal(e1, false), v2);
assertEquals(model.getParent(v1), model.getParent(v2));
assertEquals(model.getChildCount(parent), 3);
}
/**
* The main method of the template test suite.
*
* @param args
* The array of runtime arguments.
*/
public static void main(String[] args)
{
TestRunner.runAndWait(new TestSuite(mxModelTest.class));
}
}