diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 50 | ||||
-rwxr-xr-x | OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav | bin | 0 -> 211648 bytes |
2 files changed, 49 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 9e9cedd..1200105 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
215 | // Also check that direct entries which will also have a file entry containing that directory doesn't | 215 | // Also check that direct entries which will also have a file entry containing that directory doesn't |
216 | // upset load | 216 | // upset load |
217 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 217 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
218 | 218 | ||
219 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | 219 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); |
220 | 220 | ||
221 | string part1Name = "object1"; | 221 | string part1Name = "object1"; |
@@ -235,6 +235,45 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
235 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); | 235 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); |
236 | part1.Name = part1Name; | 236 | part1.Name = part1Name; |
237 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | 237 | SceneObjectGroup object1 = new SceneObjectGroup(part1); |
238 | |||
239 | // Let's put some inventory items into our object | ||
240 | UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); | ||
241 | Type type = GetType(); | ||
242 | Assembly assembly = type.Assembly; | ||
243 | string soundDataResourceName = null; | ||
244 | string[] names = assembly.GetManifestResourceNames(); | ||
245 | foreach (string name in names) | ||
246 | { | ||
247 | if (name.EndsWith(".Resources.test-sound.wav")) | ||
248 | soundDataResourceName = name; | ||
249 | } | ||
250 | Assert.That(soundDataResourceName, Is.Not.Null); | ||
251 | |||
252 | byte[] soundData; | ||
253 | Console.WriteLine("Loading " + soundDataResourceName); | ||
254 | using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) | ||
255 | { | ||
256 | using (BinaryReader br = new BinaryReader(resource)) | ||
257 | { | ||
258 | // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion | ||
259 | soundData = br.ReadBytes(99999999); | ||
260 | UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
261 | string soundAssetFileName | ||
262 | = ArchiveConstants.ASSETS_PATH + soundUuid | ||
263 | + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV]; | ||
264 | tar.WriteFile(soundAssetFileName, soundData); | ||
265 | |||
266 | /* | ||
267 | AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData); | ||
268 | scene.AssetService.Store(soundAsset); | ||
269 | asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; | ||
270 | */ | ||
271 | |||
272 | TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid }; | ||
273 | part1.Inventory.AddInventoryItem(item1, true); | ||
274 | } | ||
275 | } | ||
276 | |||
238 | scene.AddNewSceneObject(object1, false); | 277 | scene.AddNewSceneObject(object1, false); |
239 | 278 | ||
240 | string object1FileName = string.Format( | 279 | string object1FileName = string.Format( |
@@ -266,6 +305,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
266 | Assert.That( | 305 | Assert.That( |
267 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | 306 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); |
268 | 307 | ||
308 | // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load) | ||
309 | /* | ||
310 | TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid); | ||
311 | Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); | ||
312 | AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); | ||
313 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | ||
314 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | ||
315 | */ | ||
316 | |||
269 | // Temporary | 317 | // Temporary |
270 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 318 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
271 | } | 319 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav new file mode 100755 index 0000000..b45ee54 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav | |||
Binary files differ | |||