blob: fef2e7e75c0ecdc03daf0309e154673061a48cc2 [file] [log] [blame]
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();
}
}