Add LLImageManager regression test for discard case

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2012-01-19 21:14:09 +00:00
parent 63f0ec9aeb
commit 5c982c98aa
1 changed files with 53 additions and 0 deletions

View File

@ -88,5 +88,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
} }
[Test]
public void TestRequestAndDiscardImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
UUID imageId = TestHelpers.ParseTail(0x1);
string creatorId = TestHelpers.ParseTail(0x2).ToString();
UUID userId = TestHelpers.ParseTail(0x3);
J2KDecoderModule j2kdm = new J2KDecoderModule();
Scene scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, j2kdm);
TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
using (
Stream resource
= GetType().Assembly.GetManifestResourceStream(
"OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
{
using (BinaryReader br = new BinaryReader(resource))
{
AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
asset.Data = br.ReadBytes(99999999);
scene.AssetService.Store(asset);
}
}
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = imageId;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
args.requestSequence = 1;
llim.EnqueueReq(args);
// Now create a discard request
TextureRequestArgs discardArgs = new TextureRequestArgs();
discardArgs.RequestedAssetID = imageId;
discardArgs.DiscardLevel = -1;
discardArgs.PacketNumber = 1;
discardArgs.Priority = 0;
discardArgs.requestSequence = 2;
llim.EnqueueReq(discardArgs);
llim.ProcessImageQueue(20);
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
}
} }
} }