More scene and spot scene refactoring. Got parsers working for those in

the new new style (or was that the new new new style).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@739 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-12-05 03:38:10 +00:00
parent ec9986a365
commit dd69489de4
19 changed files with 544 additions and 274 deletions
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- test spot scene parser -->
<scene name="Test Scene" version="42" defaultEntranceId="3">
<location locationId="0" x="12" y="15" orientation="0" clusterIndex="0"/>
<location locationId="1" x="16" y="25" orientation="0" clusterIndex="1"/>
<location locationId="2" x="9" y="1" orientation="3" clusterIndex="1"/>
<portal locationId="3" x="1" y="25" orientation="3" name="East portal"
targetSceneName="East scene" targetPortalName="West portal"/>
<portal locationId="4" x="25" y="1" orientation="5" name="North portal"
targetSceneName="North scene" targetPortalName="South portal"/>
</scene>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- test scene parser -->
<scene name="Test Scene" version="42">
<neighbor>Some neighbor</neighbor>
<neighbor>Some other neighbor</neighbor>
<neighbor>Yet another neighbor</neighbor>
</scene>
@@ -0,0 +1,47 @@
//
// $Id: SpotSceneParserTest.java,v 1.1 2001/12/05 03:38:09 mdb Exp $
package com.threerings.whirled.tools.spot.xml;
import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.tools.spot.EditableSpotScene;
public class SpotSceneParserTest extends TestCase
{
public SpotSceneParserTest ()
{
super(SpotSceneParserTest.class.getName());
}
public void runTest ()
{
try {
SpotSceneParser parser = new SpotSceneParser("scene");
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
EditableSpotScene scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene.getSpotSceneModel() + ".");
} catch (Exception e) {
e.printStackTrace();
fail("Test threw exception");
}
}
public static Test suite ()
{
return new SpotSceneParserTest();
}
public static void main (String[] args)
{
SpotSceneParserTest test = new SpotSceneParserTest();
test.runTest();
}
protected static final String TEST_SCENE_PATH =
"whirled/tools/spot/xml/scene.xml";
}
@@ -0,0 +1,47 @@
//
// $Id: SceneParserTest.java,v 1.1 2001/12/05 03:38:10 mdb Exp $
package com.threerings.whirled.tools.xml;
import com.samskivert.test.TestUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import com.threerings.whirled.tools.EditableScene;
public class SceneParserTest extends TestCase
{
public SceneParserTest ()
{
super(SceneParserTest.class.getName());
}
public void runTest ()
{
try {
SceneParser parser = new SceneParser("scene");
String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH);
EditableScene scene = parser.parseScene(tspath);
System.out.println("Parsed " + scene.getSceneModel() + ".");
} catch (Exception e) {
e.printStackTrace();
fail("Test threw exception");
}
}
public static Test suite ()
{
return new SceneParserTest();
}
public static void main (String[] args)
{
SceneParserTest test = new SceneParserTest();
test.runTest();
}
protected static final String TEST_SCENE_PATH =
"whirled/tools/xml/scene.xml";
}