diff options
author | Justin Clark-Casey (justincc) | 2014-03-11 23:38:22 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-11 23:38:22 +0000 |
commit | d975b42f6ae01441e261d51976513de422fae3e3 (patch) | |
tree | 0f51e1b2206dfcdb7f0e0561f7c9950749ce23f8 /OpenSim/Region/CoreModules/World/Land/Tests | |
parent | Don't start KeyframeMotion timers until all the regions are ready. This preve... (diff) | |
download | opensim-SC_OLD-d975b42f6ae01441e261d51976513de422fae3e3.zip opensim-SC_OLD-d975b42f6ae01441e261d51976513de422fae3e3.tar.gz opensim-SC_OLD-d975b42f6ae01441e261d51976513de422fae3e3.tar.bz2 opensim-SC_OLD-d975b42f6ae01441e261d51976513de422fae3e3.tar.xz |
Instead of auto-creating a parcel on request if one doesn't cover a given location, fill in gaps or extend existing parcel right after initial data load.
This is in line with simpler and still existing behaviour where a default parcel is created if no parcels are in storage at all.
Making this change as another step to address current problems with spurious parcels occasionally being created.
Also adds regression tests for different load behaviours depending on existing stored parcel data.
Relates to http://opensimulator.org/mantis/view.php?id=7035
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/Tests')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs | 155 |
1 files changed, 154 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs index a886e33..6d0253d 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Tests.Common.Mock; | |||
35 | 35 | ||
36 | namespace OpenSim.Region.CoreModules.World.Land.Tests | 36 | namespace OpenSim.Region.CoreModules.World.Land.Tests |
37 | { | 37 | { |
38 | public class LandManagementModuleTests | 38 | public class LandManagementModuleTests : OpenSimTestCase |
39 | { | 39 | { |
40 | [Test] | 40 | [Test] |
41 | public void TestAddLandObject() | 41 | public void TestAddLandObject() |
@@ -78,6 +78,159 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | /// <summary> | ||
82 | /// Test parcels on region when no land data exists to be loaded. | ||
83 | /// </summary> | ||
84 | [Test] | ||
85 | public void TestLoadWithNoParcels() | ||
86 | { | ||
87 | TestHelpers.InMethod(); | ||
88 | // TestHelpers.EnableLogging(); | ||
89 | |||
90 | SceneHelpers sh = new SceneHelpers(); | ||
91 | LandManagementModule lmm = new LandManagementModule(); | ||
92 | Scene scene = sh.SetupScene(); | ||
93 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
94 | |||
95 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
96 | |||
97 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
98 | Assert.That(loAtCoord1.LandData.LocalID, Is.Not.EqualTo(0)); | ||
99 | Assert.That(loAtCoord1.LandData.GlobalID, Is.Not.EqualTo(UUID.Zero)); | ||
100 | |||
101 | ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
102 | Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID)); | ||
103 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Test parcels on region when a single parcel already exists but it does not cover the whole region. | ||
108 | /// </summary> | ||
109 | [Test] | ||
110 | public void TestLoadWithSinglePartialCoveringParcel() | ||
111 | { | ||
112 | TestHelpers.InMethod(); | ||
113 | // TestHelpers.EnableLogging(); | ||
114 | |||
115 | UUID userId = TestHelpers.ParseTail(0x1); | ||
116 | |||
117 | SceneHelpers sh = new SceneHelpers(); | ||
118 | LandManagementModule lmm = new LandManagementModule(); | ||
119 | Scene scene = sh.SetupScene(); | ||
120 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
121 | |||
122 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
123 | originalLo1.LandData.Name = "lo1"; | ||
124 | originalLo1.SetLandBitmap( | ||
125 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
126 | |||
127 | sh.SimDataService.StoreLandObject(originalLo1); | ||
128 | |||
129 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
130 | |||
131 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
132 | Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
133 | Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
134 | |||
135 | ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
136 | Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID)); | ||
137 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
138 | } | ||
139 | |||
140 | /// <summary> | ||
141 | /// Test parcels on region when a single parcel already exists but it does not cover the whole region. | ||
142 | /// </summary> | ||
143 | [Test] | ||
144 | public void TestLoadWithMultiplePartialCoveringParcels() | ||
145 | { | ||
146 | TestHelpers.InMethod(); | ||
147 | // TestHelpers.EnableLogging(); | ||
148 | |||
149 | UUID userId = TestHelpers.ParseTail(0x1); | ||
150 | |||
151 | SceneHelpers sh = new SceneHelpers(); | ||
152 | LandManagementModule lmm = new LandManagementModule(); | ||
153 | Scene scene = sh.SetupScene(); | ||
154 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
155 | |||
156 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
157 | originalLo1.LandData.Name = "lo1"; | ||
158 | originalLo1.SetLandBitmap( | ||
159 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
160 | |||
161 | sh.SimDataService.StoreLandObject(originalLo1); | ||
162 | |||
163 | ILandObject originalLo2 = new LandObject(userId, false, scene); | ||
164 | originalLo2.LandData.Name = "lo2"; | ||
165 | originalLo2.SetLandBitmap( | ||
166 | originalLo2.GetSquareLandBitmap( | ||
167 | 0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, ((int)Constants.RegionSize / 4) * 3)); | ||
168 | |||
169 | sh.SimDataService.StoreLandObject(originalLo2); | ||
170 | |||
171 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
172 | |||
173 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
174 | Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
175 | Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
176 | |||
177 | ILandObject loAtCoord2 | ||
178 | = lmm.GetLandObject((int)Constants.RegionSize - 1, (((int)Constants.RegionSize / 4) * 3) - 1); | ||
179 | Assert.That(loAtCoord2.LandData.Name, Is.EqualTo(originalLo2.LandData.Name)); | ||
180 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID)); | ||
181 | |||
182 | ILandObject loAtCoord3 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
183 | Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord1.LandData.LocalID)); | ||
184 | Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord2.LandData.LocalID)); | ||
185 | Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
186 | Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord2.LandData.GlobalID)); | ||
187 | } | ||
188 | |||
189 | /// <summary> | ||
190 | /// Test parcels on region when whole region is parcelled (which should normally always be the case). | ||
191 | /// </summary> | ||
192 | [Test] | ||
193 | public void TestLoad() | ||
194 | { | ||
195 | TestHelpers.InMethod(); | ||
196 | // TestHelpers.EnableLogging(); | ||
197 | |||
198 | UUID userId = TestHelpers.ParseTail(0x1); | ||
199 | |||
200 | SceneHelpers sh = new SceneHelpers(); | ||
201 | LandManagementModule lmm = new LandManagementModule(); | ||
202 | Scene scene = sh.SetupScene(); | ||
203 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
204 | |||
205 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
206 | originalLo1.LandData.Name = "lo1"; | ||
207 | originalLo1.SetLandBitmap( | ||
208 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
209 | |||
210 | sh.SimDataService.StoreLandObject(originalLo1); | ||
211 | |||
212 | ILandObject originalLo2 = new LandObject(userId, false, scene); | ||
213 | originalLo2.LandData.Name = "lo2"; | ||
214 | originalLo2.SetLandBitmap( | ||
215 | originalLo2.GetSquareLandBitmap(0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
216 | |||
217 | sh.SimDataService.StoreLandObject(originalLo2); | ||
218 | |||
219 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
220 | |||
221 | { | ||
222 | ILandObject loAtCoord = lmm.GetLandObject(0, 0); | ||
223 | Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
224 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
225 | } | ||
226 | |||
227 | { | ||
228 | ILandObject loAtCoord = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
229 | Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo2.LandData.Name)); | ||
230 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID)); | ||
231 | } | ||
232 | } | ||
233 | |||
81 | [Test] | 234 | [Test] |
82 | public void TestSubdivide() | 235 | public void TestSubdivide() |
83 | { | 236 | { |