diff options
author | Justin Clark-Casey (justincc) | 2012-10-25 03:02:00 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-25 03:02:00 +0100 |
commit | 8af8319b95c14819d0305527f8f6876a334fa3c0 (patch) | |
tree | 1b74153bfc34b352b15f79efca9672a870697814 /OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |
parent | When scripts generate expected exceptions (e.g. due to checked bad parameter)... (diff) | |
download | opensim-SC_OLD-8af8319b95c14819d0305527f8f6876a334fa3c0.zip opensim-SC_OLD-8af8319b95c14819d0305527f8f6876a334fa3c0.tar.gz opensim-SC_OLD-8af8319b95c14819d0305527f8f6876a334fa3c0.tar.bz2 opensim-SC_OLD-8af8319b95c14819d0305527f8f6876a334fa3c0.tar.xz |
Get osNpcCreate() and osNpcLoadAppearance() to generate a script error if appearance notecard does not exist, rather than returning UUID.Zero or silently failing.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 4e58315..b49bcc2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -127,11 +127,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
127 | OSSL_Api osslApi = new OSSL_Api(); | 127 | OSSL_Api osslApi = new OSSL_Api(); |
128 | osslApi.Initialize(m_engine, so.RootPart, null); | 128 | osslApi.Initialize(m_engine, so.RootPart, null); |
129 | 129 | ||
130 | string npcRaw | 130 | string npcRaw; |
131 | = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name"); | 131 | bool gotExpectedException = false; |
132 | 132 | try | |
133 | UUID npcId = new UUID(npcRaw); | 133 | { |
134 | Assert.That(npcId, Is.EqualTo(UUID.Zero)); | 134 | npcRaw |
135 | = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name"); | ||
136 | } | ||
137 | catch (ScriptException) | ||
138 | { | ||
139 | gotExpectedException = true; | ||
140 | } | ||
141 | |||
142 | Assert.That(gotExpectedException, Is.True); | ||
135 | } | 143 | } |
136 | 144 | ||
137 | /// <summary> | 145 | /// <summary> |
@@ -233,7 +241,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
233 | string npcRaw | 241 | string npcRaw |
234 | = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName); | 242 | = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName); |
235 | 243 | ||
236 | osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName); | 244 | bool gotExpectedException = false; |
245 | try | ||
246 | { | ||
247 | osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName); | ||
248 | } | ||
249 | catch (ScriptException) | ||
250 | { | ||
251 | gotExpectedException = true; | ||
252 | } | ||
253 | |||
254 | Assert.That(gotExpectedException, Is.True); | ||
237 | 255 | ||
238 | UUID npcId = new UUID(npcRaw); | 256 | UUID npcId = new UUID(npcRaw); |
239 | ScenePresence npc = m_scene.GetScenePresence(npcId); | 257 | ScenePresence npc = m_scene.GetScenePresence(npcId); |