aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-19 21:14:09 +0000
committerJustin Clark-Casey (justincc)2012-01-19 21:14:09 +0000
commit381f74276b94f9f635b08c4bccf3040fce5d59fb (patch)
tree9e5f58e393e3b95b7f30e8a44d8123a34f01ac13
parentAdd "image queues clear <first-name> <last-name>" console command (diff)
downloadopensim-SC_OLD-381f74276b94f9f635b08c4bccf3040fce5d59fb.zip
opensim-SC_OLD-381f74276b94f9f635b08c4bccf3040fce5d59fb.tar.gz
opensim-SC_OLD-381f74276b94f9f635b08c4bccf3040fce5d59fb.tar.bz2
opensim-SC_OLD-381f74276b94f9f635b08c4bccf3040fce5d59fb.tar.xz
Add LLImageManager regression test for discard case
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index bdc9c7d..118333c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -88,5 +88,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
88 88
89 Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); 89 Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
90 } 90 }
91
92 [Test]
93 public void TestRequestAndDiscardImage()
94 {
95 TestHelpers.InMethod();
96// XmlConfigurator.Configure();
97
98 UUID imageId = TestHelpers.ParseTail(0x1);
99 string creatorId = TestHelpers.ParseTail(0x2).ToString();
100 UUID userId = TestHelpers.ParseTail(0x3);
101
102 J2KDecoderModule j2kdm = new J2KDecoderModule();
103
104 Scene scene = SceneHelpers.SetupScene();
105 SceneHelpers.SetupSceneModules(scene, j2kdm);
106
107 TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
108 LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
109
110 using (
111 Stream resource
112 = GetType().Assembly.GetManifestResourceStream(
113 "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
114 {
115 using (BinaryReader br = new BinaryReader(resource))
116 {
117 AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
118 asset.Data = br.ReadBytes(99999999);
119 scene.AssetService.Store(asset);
120 }
121 }
122
123 TextureRequestArgs args = new TextureRequestArgs();
124 args.RequestedAssetID = imageId;
125 args.DiscardLevel = 0;
126 args.PacketNumber = 1;
127 args.Priority = 5;
128 args.requestSequence = 1;
129 llim.EnqueueReq(args);
130
131 // Now create a discard request
132 TextureRequestArgs discardArgs = new TextureRequestArgs();
133 discardArgs.RequestedAssetID = imageId;
134 discardArgs.DiscardLevel = -1;
135 discardArgs.PacketNumber = 1;
136 discardArgs.Priority = 0;
137 discardArgs.requestSequence = 2;
138 llim.EnqueueReq(discardArgs);
139
140 llim.ProcessImageQueue(20);
141
142 Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
143 }
91 } 144 }
92} \ No newline at end of file 145} \ No newline at end of file