aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs75
1 files changed, 64 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 623c82d..8cd1e84 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
182 Vector3.Zero) { Name = obj1Name, UUID = objUuid }; 182 Vector3.Zero) { Name = obj1Name, UUID = objUuid };
183 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); 183 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
184 184
185 // Note that prim hollow check is passed with the other prim params in order to allow the
186 // specification of a different check value from the prim param. A cylinder, prism, sphere,
187 // torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below
188 // specifies a value of 95% and checks to see if 70% was properly returned.
189
185 // Test a sphere. 190 // Test a sphere.
186 CheckllSetPrimitiveParams( 191 CheckllSetPrimitiveParams(
187 "test 1", // Prim test identification string 192 "test 1", // Prim test identification string
@@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
191 new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut 196 new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut
192 0.80d, // Prim hollow 197 0.80d, // Prim hollow
193 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist 198 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
194 new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple 199 new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple
200 0.80d); // Prim hollow check
195 201
196 // Test a prism. 202 // Test a prism.
197 CheckllSetPrimitiveParams( 203 CheckllSetPrimitiveParams(
@@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
203 0.90d, // Prim hollow 209 0.90d, // Prim hollow
204 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist 210 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
205 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper 211 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
206 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear 212 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
213 0.90d); // Prim hollow check
207 214
208 // Test a box. 215 // Test a box.
209 CheckllSetPrimitiveParams( 216 CheckllSetPrimitiveParams(
@@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
212 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type 219 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
213 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type 220 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
214 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 221 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
215 0.90d, // Prim hollow 222 0.95d, // Prim hollow
216 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist 223 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist
217 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper 224 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper
218 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear 225 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
226 0.95d); // Prim hollow check
219 227
220 // Test a tube. 228 // Test a tube.
221 CheckllSetPrimitiveParams( 229 CheckllSetPrimitiveParams(
@@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
232 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper 240 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper
233 1.0d, // Prim revolutions 241 1.0d, // Prim revolutions
234 1.0d, // Prim radius 242 1.0d, // Prim radius
235 0.0d); // Prim skew 243 0.0d, // Prim skew
244 0.00d); // Prim hollow check
245
246 // Test a prism.
247 CheckllSetPrimitiveParams(
248 "test 5", // Prim test identification string
249 new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size
250 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
251 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
252 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
253 0.95d, // Prim hollow
254 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
255 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
256 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
257 0.70d); // Prim hollow check
258
259 // Test a sculpted prim.
260 CheckllSetPrimitiveParams(
261 "test 6", // Prim test identification string
262 new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size
263 ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type
264 "be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map
265 ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type
236 } 266 }
237 267
238 // Set prim params for a box, cylinder or prism and check results. 268 // Set prim params for a box, cylinder or prism and check results.
239 public void CheckllSetPrimitiveParams(string primTest, 269 public void CheckllSetPrimitiveParams(string primTest,
240 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 270 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
241 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) 271 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear,
272 double primHollowCheck)
242 { 273 {
243 // Set the prim params. 274 // Set the prim params.
244 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 275 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
256 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 287 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
257 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 288 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
258 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 289 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
259 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 290 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
260 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 291 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
261 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 292 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
262 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); 293 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper");
@@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
266 // Set prim params for a sphere and check results. 297 // Set prim params for a sphere and check results.
267 public void CheckllSetPrimitiveParams(string primTest, 298 public void CheckllSetPrimitiveParams(string primTest,
268 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 299 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
269 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) 300 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck)
270 { 301 {
271 // Set the prim params. 302 // Set the prim params.
272 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 303 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
284 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 315 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
285 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 316 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
286 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 317 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
287 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 318 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
288 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 319 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
289 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 320 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
290 CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); 321 CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple");
@@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
295 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 326 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
296 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, 327 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize,
297 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, 328 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper,
298 double primRev, double primRadius, double primSkew) 329 double primRev, double primRadius, double primSkew, double primHollowCheck)
299 { 330 {
300 // Set the prim params. 331 // Set the prim params.
301 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 332 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
314 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), 345 Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
315 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); 346 "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
316 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); 347 CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
317 Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, 348 Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
318 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); 349 "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
319 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); 350 CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
320 CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); 351 CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size");
@@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
329 "TestllSetPrimitiveParams " + primTest + " prim skew fail"); 360 "TestllSetPrimitiveParams " + primTest + " prim skew fail");
330 } 361 }
331 362
363 // Set prim params for a sculpted prim and check results.
364 public void CheckllSetPrimitiveParams(string primTest,
365 LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType)
366 {
367 // Set the prim params.
368 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
369 ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType));
370
371 // Get params for prim to validate settings.
372 LSL_Types.list primParams =
373 m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
374
375 // Validate settings.
376 CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
377 Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
378 "TestllSetPrimitiveParams " + primTest + " prim type check fail");
379 Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2),
380 "TestllSetPrimitiveParams " + primTest + " prim map check fail");
381 Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3),
382 "TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail");
383 }
384
332 public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) 385 public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg)
333 { 386 {
334 // Check each vector component against expected result. 387 // Check each vector component against expected result.