aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
diff options
context:
space:
mode:
authorMicheil Merlin2011-09-04 12:21:29 -0500
committerJustin Clark-Casey (justincc)2011-09-09 22:53:45 +0100
commit28961dd1cfc21a90510faa33af6d3c1c6f8bc0af (patch)
tree6b3db49398503fe92688b3ba736100fd997e26c9 /OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
parentComment out the part of the load oar code that zeroes out prim sit target ori... (diff)
downloadopensim-SC-28961dd1cfc21a90510faa33af6d3c1c6f8bc0af.zip
opensim-SC-28961dd1cfc21a90510faa33af6d3c1c6f8bc0af.tar.gz
opensim-SC-28961dd1cfc21a90510faa33af6d3c1c6f8bc0af.tar.bz2
opensim-SC-28961dd1cfc21a90510faa33af6d3c1c6f8bc0af.tar.xz
llSetPrimitiveParams Prim type params precision errors
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs58
1 files changed, 33 insertions, 25 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 8cd1e84..0cbad41 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
49 49
50 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; 50 private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
51 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; 51 private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
52 private const double FLOAT_ACCURACY = 0.00005d; 52 private const float FLOAT_ACCURACY = 0.00005f;
53 private LSL_Api m_lslApi; 53 private LSL_Api m_lslApi;
54 54
55 [SetUp] 55 [SetUp]
@@ -194,10 +194,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
194 ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type 194 ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type
195 ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type 195 ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type
196 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
197 0.80d, // Prim hollow 197 0.80f, // Prim hollow
198 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
199 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 200 0.80f); // Prim hollow check
201 201
202 // Test a prism. 202 // Test a prism.
203 CheckllSetPrimitiveParams( 203 CheckllSetPrimitiveParams(
@@ -206,11 +206,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
206 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type 206 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
207 ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type 207 ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type
208 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 208 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
209 0.90d, // Prim hollow 209 0.90f, // Prim hollow
210 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
211 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
212 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 213 0.90f); // Prim hollow check
214 214
215 // Test a box. 215 // Test a box.
216 CheckllSetPrimitiveParams( 216 CheckllSetPrimitiveParams(
@@ -219,11 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
219 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type 219 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
220 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type 220 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
221 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
222 0.95d, // Prim hollow 222 0.95f, // Prim hollow
223 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
224 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
225 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 226 0.95f); // Prim hollow check
227 227
228 // Test a tube. 228 // Test a tube.
229 CheckllSetPrimitiveParams( 229 CheckllSetPrimitiveParams(
@@ -232,16 +232,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
232 ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type 232 ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type
233 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type 233 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
234 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 234 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
235 0.00d, // Prim hollow 235 0.00f, // Prim hollow
236 new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist 236 new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist
237 new LSL_Types.Vector3(1.0d, 0.5d, 0.0d), // Prim hole size 237 new LSL_Types.Vector3(1.0d, 0.05d, 0.0d), // Prim hole size
238 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear 238 // Expression for y selected to test precision problems during byte
239 // cast in SetPrimitiveShapeParams.
240 new LSL_Types.Vector3(0.0d, 0.35d + 0.1d, 0.0d), // Prim shear
239 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut 241 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut
240 new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper 242 // Expression for y selected to test precision problems during sbyte
241 1.0d, // Prim revolutions 243 // cast in SetPrimitiveShapeParams.
242 1.0d, // Prim radius 244 new LSL_Types.Vector3(-1.0d, 0.70d + 0.1d + 0.1d, 0.0d), // Prim taper
243 0.0d, // Prim skew 245 1.11f, // Prim revolutions
244 0.00d); // Prim hollow check 246 0.88f, // Prim radius
247 0.95f, // Prim skew
248 0.00f); // Prim hollow check
245 249
246 // Test a prism. 250 // Test a prism.
247 CheckllSetPrimitiveParams( 251 CheckllSetPrimitiveParams(
@@ -250,11 +254,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
250 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type 254 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
251 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type 255 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
252 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 256 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
253 0.95d, // Prim hollow 257 0.95f, // Prim hollow
254 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist 258 // Expression for x selected to test precision problems during sbyte
255 new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper 259 // cast in SetPrimitiveShapeBlockParams.
260 new LSL_Types.Vector3(0.7d + 0.2d, 0.0d, 0.0d), // Prim twist
261 // Expression for y selected to test precision problems during sbyte
262 // cast in SetPrimitiveShapeParams.
263 new LSL_Types.Vector3(2.0d, (1.3d + 0.1d), 0.0d), // Prim taper
256 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear 264 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
257 0.70d); // Prim hollow check 265 0.70f); // Prim hollow check
258 266
259 // Test a sculpted prim. 267 // Test a sculpted prim.
260 CheckllSetPrimitiveParams( 268 CheckllSetPrimitiveParams(
@@ -268,8 +276,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
268 // Set prim params for a box, cylinder or prism and check results. 276 // Set prim params for a box, cylinder or prism and check results.
269 public void CheckllSetPrimitiveParams(string primTest, 277 public void CheckllSetPrimitiveParams(string primTest,
270 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 278 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
271 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, 279 float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear,
272 double primHollowCheck) 280 float primHollowCheck)
273 { 281 {
274 // Set the prim params. 282 // Set the prim params.
275 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 283 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -297,7 +305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
297 // Set prim params for a sphere and check results. 305 // Set prim params for a sphere and check results.
298 public void CheckllSetPrimitiveParams(string primTest, 306 public void CheckllSetPrimitiveParams(string primTest,
299 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 307 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
300 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck) 308 float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, float primHollowCheck)
301 { 309 {
302 // Set the prim params. 310 // Set the prim params.
303 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 311 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -324,9 +332,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
324 // Set prim params for a torus, tube or ring and check results. 332 // Set prim params for a torus, tube or ring and check results.
325 public void CheckllSetPrimitiveParams(string primTest, 333 public void CheckllSetPrimitiveParams(string primTest,
326 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, 334 LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
327 double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, 335 float primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize,
328 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, 336 LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper,
329 double primRev, double primRadius, double primSkew, double primHollowCheck) 337 float primRev, float primRadius, float primSkew, float primHollowCheck)
330 { 338 {
331 // Set the prim params. 339 // Set the prim params.
332 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, 340 m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@@ -353,7 +361,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
353 CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut"); 361 CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut");
354 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper"); 362 CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper");
355 Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY, 363 Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY,
356 "TestllSetPrimitiveParams " + primTest + " prim revolution fail"); 364 "TestllSetPrimitiveParams " + primTest + " prim revolutions fail");
357 Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY, 365 Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY,
358 "TestllSetPrimitiveParams " + primTest + " prim radius fail"); 366 "TestllSetPrimitiveParams " + primTest + " prim radius fail");
359 Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY, 367 Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY,