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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-05-03 23:49:35 UTC
  • Revision ID: james.westby@ubuntu.com-20090503234935-cls7n48x018g0vk2
Tags: upstream-2.0.2+1
ImportĀ upstreamĀ versionĀ 2.0.2+1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package junit.test.svg;
 
2
 
 
3
import java.text.ParseException;
 
4
 
 
5
import junit.framework.TestCase;
 
6
import latexDraw.parsers.svg.elements.path.SVGPathSeg;
 
7
import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto;
 
8
import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg;
 
9
import latexDraw.parsers.svg.parsers.SVGPathHandler;
 
10
import latexDraw.parsers.svg.parsers.SVGPathParser;
 
11
 
 
12
import org.junit.Test;
 
13
 
 
14
/** 
 
15
 * This class contains tests for the SVGPathSegMoveto class.<br>
 
16
 *<br>
 
17
 * This file is part of LaTeXDraw<br>
 
18
 * Copyright (c) 2005-2008 Arnaud BLOUIN<br>
 
19
 *<br>
 
20
 *  LaTeXDraw is free software; you can redistribute it and/or modify
 
21
 *  it under the terms of the GNU General Public License as published by
 
22
 *  the Free Software Foundation; either version 2 of the License, or
 
23
 *  any later version.<br>
 
24
 *<br>
 
25
 *  LaTeXDraw is distributed without any warranty; without even the 
 
26
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 
27
 *  PURPOSE. See the GNU General Public License for more details.<br>
 
28
 *<br>
 
29
 * 10/23/07<br>
 
30
 * @author Arnaud BLOUIN<br>
 
31
 * @version 2.0.0<br>
 
32
 */
 
33
public class TestSVGPathSegMoveto extends TestCase implements SVGPathHandler
 
34
{
 
35
        protected final SVGPathSegMoveto seg = new SVGPathSegMoveto(-1, -2, false);
 
36
        
 
37
        @Test
 
38
        public void testGetters()
 
39
        {
 
40
                assertEquals(seg.getX(), -1.);
 
41
                assertEquals(seg.getY(), -2.);
 
42
                assertFalse(seg.isRelative());
 
43
                assertEquals(seg.getType(), PathSeg.MOVETO_ABS);
 
44
        }
 
45
        
 
46
        
 
47
        @Test
 
48
        public void testToString()
 
49
        {
 
50
                SVGPathParser parser = new SVGPathParser(seg.toString(), this);
 
51
                
 
52
                try { parser.parse(); }
 
53
                catch(ParseException e) { fail(); }
 
54
        }
 
55
 
 
56
 
 
57
        
 
58
        public void onPathSeg(SVGPathSeg pathSeg)
 
59
        {
 
60
                assertTrue(pathSeg instanceof SVGPathSegMoveto);
 
61
                
 
62
                SVGPathSegMoveto seg2 = (SVGPathSegMoveto)pathSeg;              
 
63
                
 
64
                assertEquals(seg.getX(), seg2.getX());
 
65
                assertEquals(seg.getY(), seg2.getY());
 
66
                assertEquals(seg.isRelative(), seg2.isRelative());
 
67
        }
 
68
}