Jogamp
Fixing test source compilation with new Q2TestDataUtil.
authorPatrick Woodworth <patrick@woodworth.org>
Sat, 8 Dec 2012 06:52:49 +0000 (22:52 -0800)
committerPatrick Woodworth <patrick@woodworth.org>
Sat, 8 Dec 2012 06:52:49 +0000 (22:52 -0800)
pom.xml
test/jake2/qcommon/Q2TestDataUtil.java [new file with mode: 0644]
test/jake2/render/DancingQueens.java
test/jake2/render/TestMap.java
test/jake2/render/TestRenderer.java

diff --git a/pom.xml b/pom.xml
index a2aabda..dd391f2 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
     <jake.build.outputDirectory>${project.build.directory}/classes</jake.build.outputDirectory>
     <jake.dist.lib.directory>${project.build.directory}</jake.dist.lib.directory>
     <jake.dist.dep.prefix/>
-    <jake.test.skip>true</jake.test.skip>
+    <jake.test.skip>false</jake.test.skip>
     <jake.javac.source>1.6</jake.javac.source>
     <jake.javac.target>${jake.javac.source}</jake.javac.target>
     <jogamp.version>2.0-rc11</jogamp.version>
diff --git a/test/jake2/qcommon/Q2TestDataUtil.java b/test/jake2/qcommon/Q2TestDataUtil.java
new file mode 100644 (file)
index 0000000..e273215
--- /dev/null
@@ -0,0 +1,51 @@
+package jake2.qcommon;
+
+import jake2.Jake2;
+
+import java.util.Locale;
+
+/** @author Patrick Woodworth */
+public class Q2TestDataUtil {
+
+    private static final boolean USE_DATA_DIALOG = Boolean.getBoolean("jake.data.dialog");
+
+    public static final void initQ2DataTool() {
+        if (USE_DATA_DIALOG) {
+            Q2DataDialogWrapper tmpq2DataTool = new Q2DataDialogWrapper();
+            Locale.setDefault(Locale.US);
+            tmpq2DataTool.setVisible(true);
+            Jake2.q2DataTool = tmpq2DataTool;
+        } else {
+            Jake2.q2DataTool = new Q2DataTool();
+            Locale.setDefault(Locale.US);
+        }
+    }
+
+    public static class Q2DataDialogWrapper extends Q2DataTool {
+
+        private final Q2DataDialog m_data = new Q2DataDialog();
+
+        public Q2DataDialogWrapper() {
+            super();
+        }
+
+        @Override
+        public void testQ2Data() {
+            m_data.testQ2Data();
+        }
+
+        @Override
+        void dispose() {
+            m_data.dispose();
+        }
+
+        @Override
+        void setStatus(String text) {
+            m_data.setStatus(text);
+        }
+
+        public void setVisible(boolean b) {
+            m_data.setVisible(b);
+        }
+    }
+}
index 4097d21..1b98ea0 100644 (file)
@@ -67,9 +67,7 @@ public class DancingQueens {
     
     void init() {
        Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET);
-               Jake2.Q2Dialog = new Q2DataDialog();
-               Locale.setDefault(Locale.US);
-               Jake2.Q2Dialog.setVisible(true);        
+        Q2TestDataUtil.initQ2DataTool();
         
        String DRIVER = "lwjgl";
        
index 3dd89fd..10112d1 100644 (file)
@@ -75,9 +75,7 @@ public class TestMap
         // open the q2dialog, if we are not in dedicated mode.
         if (Globals.dedicated.value != 1.0f)
         {
-            Jake2.Q2Dialog = new Q2DataDialog();
-            Locale.setDefault(Locale.US);
-            Jake2.Q2Dialog.setVisible(true);
+            Q2TestDataUtil.initQ2DataTool();
         }
         
                Qcommon.Init(new String[] { "TestMap" });
index 3c0bb7f..f12edd6 100644 (file)
@@ -72,9 +72,7 @@ public class TestRenderer {
     
     void init() {
        Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET);
-       Jake2.Q2Dialog = new Q2DataDialog();
-       Locale.setDefault(Locale.US);
-       Jake2.Q2Dialog.setVisible(true);
+       Q2TestDataUtil.initQ2DataTool();
 
        String DRIVER = "joglgl2";
 
http://JogAmp.org git info: FAQ, tutorial and man pages.