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

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
package junit.test.svg;

import java.text.ParseException;

import junit.framework.TestCase;
import latexDraw.parsers.svg.elements.path.SVGPathSeg;
import latexDraw.parsers.svg.elements.path.SVGPathSegMoveto;
import latexDraw.parsers.svg.elements.path.SVGPathSeg.PathSeg;
import latexDraw.parsers.svg.parsers.SVGPathHandler;
import latexDraw.parsers.svg.parsers.SVGPathParser;

import org.junit.Test;

/** 
 * This class contains tests for the SVGPathSegMoveto class.<br>
 *<br>
 * This file is part of LaTeXDraw<br>
 * Copyright (c) 2005-2008 Arnaud BLOUIN<br>
 *<br>
 *  LaTeXDraw is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.<br>
 *<br>
 *  LaTeXDraw is distributed without any warranty; without even the 
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 *  PURPOSE. See the GNU General Public License for more details.<br>
 *<br>
 * 10/23/07<br>
 * @author Arnaud BLOUIN<br>
 * @version 2.0.0<br>
 */
public class TestSVGPathSegMoveto extends TestCase implements SVGPathHandler
{
	protected final SVGPathSegMoveto seg = new SVGPathSegMoveto(-1, -2, false);
	
	@Test
	public void testGetters()
	{
		assertEquals(seg.getX(), -1.);
		assertEquals(seg.getY(), -2.);
		assertFalse(seg.isRelative());
		assertEquals(seg.getType(), PathSeg.MOVETO_ABS);
	}
	
	
	@Test
	public void testToString()
	{
		SVGPathParser parser = new SVGPathParser(seg.toString(), this);
		
		try { parser.parse(); }
		catch(ParseException e) { fail(); }
	}


	
	public void onPathSeg(SVGPathSeg pathSeg)
	{
		assertTrue(pathSeg instanceof SVGPathSegMoveto);
		
		SVGPathSegMoveto seg2 = (SVGPathSegMoveto)pathSeg;		
		
		assertEquals(seg.getX(), seg2.getX());
		assertEquals(seg.getY(), seg2.getY());
		assertEquals(seg.isRelative(), seg2.isRelative());
	}
}