Split out to-be-common setup stuff from TestOsOwnerSaveAppearance()

bulletsim
Justin Clark-Casey (justincc) 2011-08-11 20:56:18 +01:00
parent 5d694a224f
commit 83ca5a101d
1 changed files with 33 additions and 15 deletions

View File

@ -50,35 +50,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[TestFixture] [TestFixture]
public class OSSL_ApiAppearanceTest public class OSSL_ApiAppearanceTest
{ {
[Test] protected Scene m_scene;
public void TestOsOwnerSaveAppearance() protected XEngine.XEngine m_engine;
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
[SetUp]
public void SetUp()
{
IConfigSource initConfigSource = new IniConfigSource(); IConfigSource initConfigSource = new IniConfigSource();
IConfig config = initConfigSource.AddConfig("XEngine"); IConfig config = initConfigSource.AddConfig("XEngine");
config.Set("Enabled", "true"); config.Set("Enabled", "true");
config.Set("AllowOSFunctions", "true"); config.Set("AllowOSFunctions", "true");
config.Set("OSFunctionThreatLevel", "Severe"); config.Set("OSFunctionThreatLevel", "Severe");
m_scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(m_scene, new AvatarFactoryModule());
m_engine = new XEngine.XEngine();
m_engine.Initialise(initConfigSource);
m_engine.AddRegion(m_scene);
}
/// <summary>
/// Test creation of an NPC where the appearance data comes from a notecard
/// </summary>
// [Test]
// public void TestOsNpcCreateFromNotecard()
// {
// TestHelpers.InMethod();
//// log4net.Config.XmlConfigurator.Configure();
// }
[Test]
public void TestOsOwnerSaveAppearance()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1); UUID userId = TestHelpers.ParseTail(0x1);
float newHeight = 1.9f; float newHeight = 1.9f;
Scene scene = SceneHelpers.SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
SceneHelpers.SetupSceneModules(scene, new AvatarFactoryModule());
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
sp.Appearance.AvatarHeight = newHeight; sp.Appearance.AvatarHeight = newHeight;
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
SceneObjectPart part = so.RootPart; SceneObjectPart part = so.RootPart;
scene.AddSceneObject(so); m_scene.AddSceneObject(so);
XEngine.XEngine engine = new XEngine.XEngine();
engine.Initialise(initConfigSource);
engine.AddRegion(scene);
OSSL_Api osslApi = new OSSL_Api(); OSSL_Api osslApi = new OSSL_Api();
osslApi.Initialize(engine, part, part.LocalId, part.UUID); osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
string notecardName = "appearanceNc"; string notecardName = "appearanceNc";
@ -90,7 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TaskInventoryItem ncItem = items[0]; TaskInventoryItem ncItem = items[0];
Assert.That(ncItem.Name, Is.EqualTo(notecardName)); Assert.That(ncItem.Name, Is.EqualTo(notecardName));
AssetBase ncAsset = scene.AssetService.Get(ncItem.AssetID.ToString()); AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString());
Assert.That(ncAsset, Is.Not.Null); Assert.That(ncAsset, Is.Not.Null);
AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data);