29 using System.Collections.Generic;
30 using System.Reflection;
34 using NUnit.Framework;
36 using OpenMetaverse.Assets;
37 using OpenMetaverse.StructuredData;
38 using OpenSim.Framework;
39 using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40 using OpenSim.Region.OptionalModules.World.NPC;
41 using OpenSim.Region.Framework.Scenes;
42 using OpenSim.Region.ScriptEngine.Shared;
43 using OpenSim.Region.ScriptEngine.Shared.Api;
44 using OpenSim.Region.ScriptEngine.Shared.Instance;
45 using OpenSim.Services.Interfaces;
46 using OpenSim.Tests.Common;
48 namespace OpenSim.
Region.ScriptEngine.Shared.Tests
64 IConfigSource initConfigSource =
new IniConfigSource();
65 IConfig config = initConfigSource.AddConfig(
"XEngine");
66 config.Set(
"Enabled",
"true");
67 config.Set(
"AllowOSFunctions",
"true");
68 config.Set(
"OSFunctionThreatLevel",
"Severe");
69 config = initConfigSource.AddConfig(
"NPC");
70 config.Set(
"Enabled",
"true");
76 m_engine.Initialise(initConfigSource);
77 m_engine.AddRegion(m_scene);
83 TestHelpers.InMethod();
86 UUID userId = TestHelpers.ParseTail(0x1);
87 float newHeight = 1.9f;
89 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
90 sp.Appearance.AvatarHeight = newHeight;
93 m_scene.AddSceneObject(so);
96 osslApi.Initialize(m_engine, part, null);
98 string notecardName =
"appearanceNc";
100 osslApi.osOwnerSaveAppearance(notecardName);
102 IList<TaskInventoryItem> items = part.Inventory.GetInventoryItems(notecardName);
103 Assert.That(items.Count, Is.EqualTo(1));
106 Assert.That(ncItem.Name, Is.EqualTo(notecardName));
108 AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString());
109 Assert.That(ncAsset, Is.Not.Null);
111 AssetNotecard anc =
new AssetNotecard(UUID.Zero, ncAsset.Data);
113 OSDMap appearanceOsd = (
OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText);
115 savedAppearance.Unpack(appearanceOsd);
117 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
123 TestHelpers.InMethod();
126 UUID ownerId = TestHelpers.ParseTail(0x1);
127 UUID nonOwnerId = TestHelpers.ParseTail(0x2);
128 float newHeight = 1.9f;
130 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId);
131 sp.Appearance.AvatarHeight = newHeight;
134 m_scene.AddSceneObject(so);
137 osslApi.Initialize(m_engine, part, null);
139 string notecardName =
"appearanceNc";
141 osslApi.osAgentSaveAppearance(
new LSL_Types.LSLString(nonOwnerId.ToString()), notecardName);
143 IList<TaskInventoryItem> items = part.Inventory.GetInventoryItems(notecardName);
144 Assert.That(items.Count, Is.EqualTo(1));
147 Assert.That(ncItem.Name, Is.EqualTo(notecardName));
149 AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString());
150 Assert.That(ncAsset, Is.Not.Null);
152 AssetNotecard anc =
new AssetNotecard(UUID.Zero, ncAsset.Data);
154 OSDMap appearanceOsd = (
OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText);
156 savedAppearance.Unpack(appearanceOsd);
158 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
Contains the Avatar's Appearance and methods to manipulate the appearance.
OpenMetaverse.StructuredData.OSDMap OSDMap
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Represents an item in a task inventory
void TestOsAgentSaveAppearance()
Asset class. All Assets are reference by this class or a class derived from this class ...
void TestOsOwnerSaveAppearance()
Helpers for setting up scenes.