summaryrefslogtreecommitdiffstats
path: root/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java
blob: fef2e7e75c0ecdc03daf0309e154673061a48cc2 (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package org.eclipse.swt.tests.junit;

/*
 * (c) Copyright IBM Corp. 2000, 2002. All rights reserved.
 * This file is made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 */

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import junit.framework.*;
import junit.textui.*;

/**
 * Automated Test Suite for class org.eclipse.swt.graphics.FontMetrics
 *
 * @see org.eclipse.swt.graphics.FontMetrics
 */
public class Test_org_eclipse_swt_graphics_FontMetrics extends SwtTestCase {

	Display display;
	Shell shell;
	GC gc;

public Test_org_eclipse_swt_graphics_FontMetrics(String name) {
	super(name);
}

public static void main(String[] args) {
	TestRunner.run(suite());
}

protected void setUp() {
	display = new Display();
	shell = new Shell(display);
	gc = new GC(shell);
}

protected void tearDown() {
	gc.dispose();
	shell.dispose();
	display.dispose();
}

public void test_equalsLjava_lang_Object() {
	FontMetrics fm1 = gc.getFontMetrics();
	FontMetrics fm2 = gc.getFontMetrics();
	assertTrue(fm1.equals(fm2));
}

public void test_getAscent() {
	FontMetrics fm = gc.getFontMetrics();
	fm.getAscent();
}

public void test_getAverageCharWidth() {
	FontMetrics fm = gc.getFontMetrics();
	fm.getAverageCharWidth();
}

public void test_getDescent() {
	FontMetrics fm = gc.getFontMetrics();
	fm.getDescent();
}

public void test_getHeight() {
	FontMetrics fm = gc.getFontMetrics();
	fm.getHeight();
}

public void test_getLeading() {
	FontMetrics fm = gc.getFontMetrics();
	fm.getLeading();
}

public void test_hashCode() {
	FontMetrics fm1 = gc.getFontMetrics();
	FontMetrics fm2 = gc.getFontMetrics();
	if (fm1.equals(fm2)) {
		assertEquals(fm1.hashCode(), fm2.hashCode());
	}
}

public void test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC() {
	// do not test - Windows only
}

public static Test suite() {
	TestSuite suite = new TestSuite();
	java.util.Vector methodNames = methodNames();
	java.util.Enumeration e = methodNames.elements();
	while (e.hasMoreElements()) {
		suite.addTest(new Test_org_eclipse_swt_graphics_FontMetrics((String)e.nextElement()));
	}
	return suite;
}
public static java.util.Vector methodNames() {
	java.util.Vector methodNames = new java.util.Vector();
	methodNames.addElement("test_equalsLjava_lang_Object");
	methodNames.addElement("test_getAscent");
	methodNames.addElement("test_getAverageCharWidth");
	methodNames.addElement("test_getDescent");
	methodNames.addElement("test_getHeight");
	methodNames.addElement("test_getLeading");
	methodNames.addElement("test_hashCode");
	methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC");
	return methodNames;
}
protected void runTest() throws Throwable {
	if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object();
	else if (getName().equals("test_getAscent")) test_getAscent();
	else if (getName().equals("test_getAverageCharWidth")) test_getAverageCharWidth();
	else if (getName().equals("test_getDescent")) test_getDescent();
	else if (getName().equals("test_getHeight")) test_getHeight();
	else if (getName().equals("test_getLeading")) test_getLeading();
	else if (getName().equals("test_hashCode")) test_hashCode();
	else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC")) test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC();
}
}