aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-05 02:18:03 +0000
committerJustin Clark-Casey (justincc)2011-03-05 02:18:03 +0000
commit9f85ee29ac9f5e0aa8c1976944f9af12da3514db (patch)
treef691f174d2cbab49415112fcba5dd828fe18d501
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-9f85ee29ac9f5e0aa8c1976944f9af12da3514db.zip
opensim-SC_OLD-9f85ee29ac9f5e0aa8c1976944f9af12da3514db.tar.gz
opensim-SC_OLD-9f85ee29ac9f5e0aa8c1976944f9af12da3514db.tar.bz2
opensim-SC_OLD-9f85ee29ac9f5e0aa8c1976944f9af12da3514db.tar.xz
Change MoapModule.ClearMediaEntry to set TextureEntryFace.MediaFlags back to false
Implement test for ClearMediaEntry()
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs45
3 files changed, 68 insertions, 9 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 927415e..7b5fb2e 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -250,7 +250,7 @@ namespace OpenSim.Framework
250 { 250 {
251 get 251 get
252 { 252 {
253 //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); 253// m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
254 try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } 254 try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); }
255 catch { } 255 catch { }
256 256
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index b6ec6dc..ffb3221 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -225,6 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
225 return me; 225 return me;
226 } 226 }
227 227
228 /// <summary>
229 /// Set the media entry on the face of the given part.
230 /// </summary>
231 /// <param name="part">/param>
232 /// <param name="face"></param>
233 /// <param name="me"></param>
228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) 234 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
229 { 235 {
230// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face); 236// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
@@ -249,9 +255,31 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
249 part.TriggerScriptChangedEvent(Changed.MEDIA); 255 part.TriggerScriptChangedEvent(Changed.MEDIA);
250 } 256 }
251 257
258 /// <summary>
259 /// Clear the media entry from the face of the given part.
260 /// </summary>
261 /// <param name="part"></param>
262 /// <param name="face"></param>
252 public void ClearMediaEntry(SceneObjectPart part, int face) 263 public void ClearMediaEntry(SceneObjectPart part, int face)
253 { 264 {
254 SetMediaEntry(part, face, null); 265 CheckFaceParam(part, face);
266
267 // If no media has been set up yetthen we don't need to clear anything
268 if (null == part.Shape.Media)
269 return;
270
271 lock (part.Shape.Media)
272 part.Shape.Media[face] = null;
273
274 UpdateMediaUrl(part, UUID.Zero);
275
276 Primitive.TextureEntry te = part.Shape.Textures;
277 Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
278 teFace.MediaFlags = false;
279 part.Shape.Textures = te;
280
281 part.ScheduleFullUpdate();
282 part.TriggerScriptChangedEvent(Changed.MEDIA);
255 } 283 }
256 284
257 /// <summary> 285 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
index 9e5c7ae..7a68e55 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -48,21 +48,52 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
48 [TestFixture] 48 [TestFixture]
49 public class MoapTests 49 public class MoapTests
50 { 50 {
51 protected TestScene m_scene;
52 protected MoapModule m_module;
53
54 [SetUp]
55 public void SetUp()
56 {
57 m_module = new MoapModule();
58 m_scene = SceneSetupHelpers.SetupScene();
59 SceneSetupHelpers.SetupSceneModules(m_scene, m_module);
60 }
61
62 [Test]
63 public void TestClearMediaUrl()
64 {
65 TestHelper.InMethod();
66// log4net.Config.XmlConfigurator.Configure();
67
68 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
69 MediaEntry me = new MediaEntry();
70
71 m_module.SetMediaEntry(part, 1, me);
72 m_module.ClearMediaEntry(part, 1);
73
74 Assert.That(part.Shape.Media[1], Is.EqualTo(null));
75
76 // Although we've cleared one face, other faces may still be present. So we need to check for an
77 // update media url version
78 Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000001/" + UUID.Zero));
79
80 // By changing media flag to false, the face texture once again becomes identical to the DefaultTexture.
81 // Therefore, when libOMV reserializes it, it disappears and we are left with no face texture in this slot.
82 // Not at all confusing, eh?
83 Assert.That(part.Shape.Textures.FaceTextures[1], Is.Null);
84 }
85
51 [Test] 86 [Test]
52 public void TestSetMediaUrl() 87 public void TestSetMediaUrl()
53 { 88 {
54 TestHelper.InMethod(); 89 TestHelper.InMethod();
55 90
56 string homeUrl = "opensimulator.org"; 91 string homeUrl = "opensimulator.org";
57
58 MoapModule module = new MoapModule();
59 TestScene scene = SceneSetupHelpers.SetupScene();
60 SceneSetupHelpers.SetupSceneModules(scene, module);
61 92
62 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 93 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
63 MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; 94 MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
64 95
65 module.SetMediaEntry(part, 1, me); 96 m_module.SetMediaEntry(part, 1, me);
66 97
67 Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl)); 98 Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl));
68 Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero)); 99 Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero));