// XAAL toolkit // Copyright (C) 2009 Ville Karavirta // // This program 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 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but 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. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . package tests.xaal.objects.graphical; import xaal.objects.graphical.Font; import xaal.util.XaalConstants; import junit.framework.TestCase; public class FontTest extends TestCase { private Font f; public FontTest(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); f = new Font(); } protected void tearDown() throws Exception { super.tearDown(); } public void testBold() { assertEquals("Font boldness not false by default", false, f.isBold()); f.setBold(true); assertEquals("setFont not working properly", true, f.isBold()); f.setBold(false); assertEquals("setFont not working properly", false, f.isBold()); } public void testFamily() { assertEquals(XaalConstants.DEFAULT_PROPERTY_FONTFAMILY, f.getFamily()); f.setFamily("monospaced"); assertEquals("monospaced", f.getFamily()); f.setFamily(null); assertEquals("monospaced", f.getFamily()); f.setFamily("serif"); assertEquals("serif", f.getFamily()); f.setFamily("serriff"); assertEquals("serif", f.getFamily()); f.setFamily("sansserif"); assertEquals("sansserif", f.getFamily()); } public void testItalic() { assertEquals("Font italics not false by default", false, f.isItalic()); f.setItalic(true); assertEquals("setFont not working properly", true, f.isItalic()); f.setItalic(false); assertEquals("setFont not working properly", false, f.isItalic()); } public void testSize() { assertEquals(XaalConstants.DEFAULT_PROPERTY_FONTSIZE, f.getSize()); f.setSize(3); assertEquals(3, f.getSize()); f.setSize(-1); assertEquals(3, f.getSize()); } }