~ubuntu-branches/debian/sid/latexdraw/sid

« back to all changes in this revision

Viewing changes to junit/test/svg/TestSVGPolylineElement.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-07-15 23:35:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090715233552-2bblktyf2lmrkyo3
Tags: 2.0.3+1-1
* New upstream release.
* Add additional Recommended packages for new export features.
* Fix typo in long description, with thanks to Kai Weber (Closes: #529195).
* Bump standards to 3.8.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package junit.test.svg;
2
2
 
3
3
import java.awt.geom.Point2D;
 
4
import java.text.ParseException;
4
5
import java.util.Vector;
5
6
 
6
7
import latexDraw.parsers.svg.MalformedSVGDocument;
44
45
                        assertEquals(pl.getPoints(), path);
45
46
                }
46
47
                catch(MalformedSVGDocument e) { fail(); }
 
48
                catch(ParseException e)       { fail(); }
47
49
        }
48
50
        
49
51
        
58
60
                        assertTrue(pl.enableRendering());
59
61
                }
60
62
                catch(MalformedSVGDocument e) { fail(); }
61
 
        }
 
63
                catch(ParseException e)       { fail(); }
 
64
        }
 
65
        
 
66
        
 
67
        
 
68
        @Test
 
69
        public void testSetPoints()
 
70
        {
 
71
                try
 
72
                {
 
73
                        String path = "10,10 20,20";
 
74
                        node.setAttribute(SVGAttributes.SVG_POINTS, "10,10 20,20");
 
75
                        SVGPolyLineElement pl = new SVGPolyLineElement(node, null);
 
76
                        
 
77
                        assertEquals(pl.getPoints(), path);
 
78
                        pl.setPoints("10,10 20,20");
 
79
                        assertEquals(2, pl.getPoints2D().size());
 
80
                        assertEquals(new Point2D.Double(10, 10), pl.getPoints2D().firstElement());
 
81
                        assertEquals(new Point2D.Double(20, 20), pl.getPoints2D().lastElement());
 
82
                        
 
83
                        try { 
 
84
                                pl.setPoints("10,,20fdsf"); 
 
85
                                fail(); 
 
86
                        }
 
87
                        catch(ParseException e) { /* */ }
 
88
                }
 
89
                catch(MalformedSVGDocument e) { fail(); }
 
90
                catch(ParseException e)       { fail(); }
 
91
        }
 
92
        
62
93
        
63
94
        
64
95
        @Test
80
111
                        assertEquals(new Point2D.Double(30, 30), pts.lastElement());
81
112
                }
82
113
                catch(MalformedSVGDocument e) { fail(); }
 
114
                catch(ParseException e)       { fail(); }
83
115
        }
84
116
        
85
117
        
100
132
                        fail();
101
133
                }
102
134
                catch(MalformedSVGDocument e){/**/}
 
135
                catch(ParseException e)      {/**/}
103
136
                
104
137
                try
105
138
                {
106
139
                        node.setAttribute(SVGAttributes.SVG_POINTS, "");
107
140
                        new SVGPolyLineElement(node, null);
108
 
                        fail();
109
141
                }
110
 
                catch(MalformedSVGDocument e){/**/}
 
142
                catch(MalformedSVGDocument e){fail();}
 
143
                catch(ParseException e)      {fail();}
111
144
                
112
145
                try
113
146
                {
116
149
                        fail();
117
150
                }
118
151
                catch(MalformedSVGDocument e){/**/}
 
152
                catch(ParseException e)      {/**/}
119
153
                
120
154
                try
121
155
                {
122
156
                        node.setAttribute(SVGAttributes.SVG_POINTS, "10,10");
123
157
                        new SVGPolyLineElement(node, null);
124
 
                        fail();
125
158
                }
126
 
                catch(MalformedSVGDocument e){/**/}
 
159
                catch(MalformedSVGDocument e){fail();}
 
160
                catch(ParseException e)      {fail();}
127
161
                
128
162
                try
129
163
                {
132
166
                        fail();
133
167
                }
134
168
                catch(MalformedSVGDocument e){/**/}
 
169
                catch(ParseException e)      {/**/}
135
170
                
136
171
                try
137
172
                {
139
174
                        new SVGPolyLineElement(node, null);
140
175
                }
141
176
                catch(MalformedSVGDocument e) { fail(); }
 
177
                catch(ParseException e)       { fail(); }
142
178
        }
143
179
        
144
180