Revision: 732
Author: allain.lalonde
Date: Fri Oct 16 06:59:05 2009
Log: Getting SWT test to be ignored when running them in headless mode.
http://code.google.com/p/piccolo2d/source/detail?r=732

Added:
   
/piccolo2d.java/trunk/swt/src/test/java/edu/umd/cs/piccolox/swt/SWTTest.java
Modified:
   
/piccolo2d.java/trunk/swt/src/test/java/edu/umd/cs/piccolox/swt/PSWTTextTest.java

=======================================
--- /dev/null
+++  
/piccolo2d.java/trunk/swt/src/test/java/edu/umd/cs/piccolox/swt/SWTTest.java    
 
Fri Oct 16 06:59:05 2009
@@ -0,0 +1,11 @@
+package edu.umd.cs.piccolox.swt;
+
+import java.awt.GraphicsEnvironment;
+
+import junit.framework.TestCase;
+
+public abstract class SWTTest extends TestCase {
+       public final boolean isHeadless() {
+               return GraphicsEnvironment.isHeadless();
+       }
+}
=======================================
---  
/piccolo2d.java/trunk/swt/src/test/java/edu/umd/cs/piccolox/swt/PSWTTextTest.java
        
Thu Oct 15 12:01:52 2009
+++  
/piccolo2d.java/trunk/swt/src/test/java/edu/umd/cs/piccolox/swt/PSWTTextTest.java
        
Fri Oct 16 06:59:05 2009
@@ -2,17 +2,22 @@

  import junit.framework.TestCase;

-public class PSWTTextTest extends TestCase {
+public class PSWTTextTest extends SWTTest {
      private PSWTText testNode;

-    public void setUp() {
-        //testNode = new PSWTText();
+    public void setUp() {
+       if (isHeadless())
+               return;
+
+        testNode = new PSWTText();
      }

      public void testTextPersistsTrainingAndInternalNewlines() {
-        // TODO: Make this work in headless mode if possible.
-        // testNode.setText("Hello\nWorld\n\n");
-        // assertEquals("Hello\nWorld\n\n", testNode.getText());
+       if (isHeadless())
+               return;
+
+        testNode.setText("Hello\nWorld\n\n");
+        assertEquals("Hello\nWorld\n\n", testNode.getText());
      }

  }

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to