Add LLImageManager regression test for discard case
parent
63f0ec9aeb
commit
5c982c98aa
|
@ -88,5 +88,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
|||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue