PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/org/mt4j/test/components/visibleComponents/font/FontLoadingTest.java

http://mt4j.googlecode.com/
Java | 44 lines | 34 code | 10 blank | 0 comment | 0 complexity | 246d1907c1cc1fb63b7abf0f9d3a0671 MD5 | raw file
 1package org.mt4j.test.components.visibleComponents.font;
 2
 3import org.mt4j.MTApplication;
 4import org.mt4j.components.visibleComponents.font.FontManager;
 5import org.mt4j.components.visibleComponents.font.IFont;
 6import org.mt4j.components.visibleComponents.widgets.MTTextArea;
 7import org.mt4j.test.AbstractWindowTestcase;
 8import org.mt4j.test.testUtil.DummyScene;
 9import org.mt4j.test.testUtil.TestRunnable;
10import org.mt4j.util.MTColor;
11
12public class FontLoadingTest extends AbstractWindowTestcase {
13
14	private DummyScene scene;
15
16	@Override
17	public void inStartUp(MTApplication app) {
18		this.scene = new DummyScene(app, "scene");
19		app.addScene(scene);
20	}
21	
22	public void testLoadFonts(){
23		this.runTest(new TestRunnable() {
24			@Override
25			public void runMTTestCode() {
26				IFont font1 = FontManager.getInstance().createFont(getMTApplication(), "arial.ttf", 16, MTColor.GREY, true);
27				IFont font2 = FontManager.getInstance().createFont(getMTApplication(), "arial", 16, MTColor.BLACK, false);
28				
29				MTTextArea ta = new MTTextArea(getMTApplication(), font1);
30				ta.setText("this is a\ntest text written for testing\npurposes");
31				scene.getCanvas().addChild(ta);
32				ta.setFont(font2);
33				
34				MTTextArea ta2 = new MTTextArea(getMTApplication(),200, 200,100, 200, font2);
35				ta2.setText("this is another test text written for testing purposes");
36				scene.getCanvas().addChild(ta2);
37				ta2.setFont(font1);
38			}
39		});
40	}
41	
42	
43
44}