diff options
author | Justin Clark-Casey (justincc) | 2014-03-05 00:35:02 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-05 00:38:38 +0000 |
commit | c9415fd76378af35ff76037d46245f2b95e4264f (patch) | |
tree | 1ea2d0e4e183dd96a7b9533aaf5c166cf864e47b /OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | |
parent | When positioning agent with PRIM_ROTATION in llSetLinkPrimitiveParams(), set ... (diff) | |
download | opensim-SC_OLD-c9415fd76378af35ff76037d46245f2b95e4264f.zip opensim-SC_OLD-c9415fd76378af35ff76037d46245f2b95e4264f.tar.gz opensim-SC_OLD-c9415fd76378af35ff76037d46245f2b95e4264f.tar.bz2 opensim-SC_OLD-c9415fd76378af35ff76037d46245f2b95e4264f.tar.xz |
If an avatar is sitting, send out position updates to clients for any change, not just those outside the usual tolerances.
This is to allow small adjustments of less than 0.05m in functions such as llSetPrimitiveLinkParams() to work
This is another fix for http://opensimulator.org/mantis/view.php?id=7044
Extends regression test for this case.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs index 86381c4..1415925 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | |||
@@ -77,14 +77,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
77 | m_engine.AddRegion(m_scene); | 77 | m_engine.AddRegion(m_scene); |
78 | } | 78 | } |
79 | 79 | ||
80 | /// <summary> | ||
81 | /// Test llSetLinkPrimtiveParams for agents. | ||
82 | /// </summary> | ||
83 | /// <remarks> | ||
84 | /// Also testing entity updates here as well. Possibly that's putting 2 different concerns into one test and | ||
85 | /// this should be separated. | ||
86 | /// </remarks> | ||
80 | [Test] | 87 | [Test] |
81 | public void TestllSetLinkPrimitiveParamsForAgent() | 88 | public void TestllSetLinkPrimitiveParamsForAgent() |
82 | { | 89 | { |
83 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
91 | // TestHelpers.EnableLogging(); | ||
84 | 92 | ||
85 | UUID userId = TestHelpers.ParseTail(0x1); | 93 | UUID userId = TestHelpers.ParseTail(0x1); |
86 | 94 | ||
87 | new SceneHelpers().SetupScene(); | ||
88 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; | 95 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
89 | part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); | 96 | part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); |
90 | 97 | ||
@@ -99,12 +106,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | 106 | ||
100 | sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); | 107 | sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); |
101 | 108 | ||
109 | int entityUpdates = 0; | ||
110 | ((TestClient)sp.ControllingClient).OnReceivedEntityUpdate += (entity, flags) => { if (entity is ScenePresence) { entityUpdates++; }}; | ||
111 | |||
102 | // Test position | 112 | // Test position |
103 | { | 113 | { |
104 | Vector3 newPos = new Vector3(1, 2, 3); | 114 | Vector3 newPos = new Vector3(1, 2, 3); |
105 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); | 115 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); |
106 | 116 | ||
107 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); | 117 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); |
118 | |||
119 | m_scene.Update(1); | ||
120 | Assert.That(entityUpdates, Is.EqualTo(1)); | ||
121 | } | ||
122 | |||
123 | // Test small reposition | ||
124 | { | ||
125 | Vector3 newPos = new Vector3(1.001f, 2, 3); | ||
126 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); | ||
127 | |||
128 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); | ||
129 | |||
130 | m_scene.Update(1); | ||
131 | Assert.That(entityUpdates, Is.EqualTo(2)); | ||
108 | } | 132 | } |
109 | 133 | ||
110 | // Test world rotation | 134 | // Test world rotation |
@@ -114,6 +138,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
114 | 138 | ||
115 | Assert.That( | 139 | Assert.That( |
116 | sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001)); | 140 | sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001)); |
141 | |||
142 | m_scene.Update(1); | ||
143 | Assert.That(entityUpdates, Is.EqualTo(3)); | ||
117 | } | 144 | } |
118 | 145 | ||
119 | // Test local rotation | 146 | // Test local rotation |
@@ -123,6 +150,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
123 | 150 | ||
124 | Assert.That( | 151 | Assert.That( |
125 | sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001)); | 152 | sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001)); |
153 | |||
154 | m_scene.Update(1); | ||
155 | Assert.That(entityUpdates, Is.EqualTo(4)); | ||
126 | } | 156 | } |
127 | } | 157 | } |
128 | } | 158 | } |