OSDN Git Service

messed around with FilesTest, internal, external and absolute work, local seems to...
authorbadlogic <contact@badlogicgames.com>
Tue, 9 Oct 2012 22:37:38 +0000 (00:37 +0200)
committerbadlogic <contact@badlogicgames.com>
Tue, 9 Oct 2012 22:37:38 +0000 (00:37 +0200)
tests/gdx-tests-iosmonotouch/gdx-tests-iosmonotouch/convert.xml
tests/gdx-tests/src/com/badlogic/gdx/tests/FilesTest.java

index aafc5af..1e0a84b 100644 (file)
@@ -11,7 +11,7 @@
        <target name="compile">
                <delete dir="target"/>
                <mkdir dir="target"/>
-               <javac srcdir="${SRC}" destdir="target" classpath="${CLASSPATH}">
+               <javac srcdir="${SRC}" destdir="target" classpath="${CLASSPATH}" debug="true" debuglevel="lines, vars, and source">
                        <include name="**/*.java"/>
                        <exclude name="${EXCLUDE}"/>
                </javac>
index 5a3d99d..59bed7f 100644 (file)
@@ -39,7 +39,7 @@ public class FilesTest extends GdxTest {
 \r
        @Override\r
        public void create () {\r
-               font = new BitmapFont();\r
+               font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);\r
                batch = new SpriteBatch();\r
 \r
                if (Gdx.files.isExternalStorageAvailable()) {\r
@@ -177,6 +177,8 @@ public class FilesTest extends GdxTest {
        }\r
 \r
        private void testClasspath () throws IOException {\r
+               // no classpath support on ios\r
+               if(Gdx.app.getType() == ApplicationType.iOS) return;\r
                FileHandle handle = Gdx.files.classpath("com/badlogic/gdx/utils/arial-15.png");\r
                if (!handle.exists()) fail();\r
                if (handle.isDirectory()) fail();\r
@@ -207,16 +209,16 @@ public class FilesTest extends GdxTest {
 \r
        private void testInternal () throws IOException {\r
                FileHandle handle = Gdx.files.internal("data/badlogic.jpg");\r
-               if (!handle.exists()) fail();\r
-               if (handle.isDirectory()) fail();\r
+               if (!handle.exists()) fail("Couldn't find internal file");\r
+               if (handle.isDirectory()) fail("Internal file shouldn't be a directory");\r
                try {\r
                        handle.delete();\r
-                       fail();\r
+                       fail("Shouldn't be able to delete internal file");\r
                } catch (Exception expected) {\r
                }\r
-               if (handle.list().length != 0) fail();\r
+               if (handle.list().length != 0) fail("File length shouldn't be 0");\r
                if (Gdx.app.getType() != ApplicationType.Android) {\r
-                       if (!handle.parent().exists()) fail();\r
+                       if (!handle.parent().exists()) fail("Parent doesn't exist");\r
                }\r
                try {\r
                        handle.read().close();\r
@@ -224,7 +226,7 @@ public class FilesTest extends GdxTest {
                } catch (Exception ignored) {\r
                }\r
                FileHandle dir;\r
-               if (Gdx.app.getType() == ApplicationType.Android)\r
+               if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS)\r
                        dir = Gdx.files.internal("data");\r
                else\r
                        dir = Gdx.files.internal("../gdx-tests-android/assets/data");\r
@@ -465,6 +467,10 @@ public class FilesTest extends GdxTest {
        private void fail () {\r
                throw new RuntimeException();\r
        }\r
+       \r
+       private void fail(String msg) {\r
+               throw new RuntimeException(msg);\r
+       }\r
 \r
        @Override\r
        public void render () {\r