refactor: separate out common parts of LLImageManagerTests
parent
5c982c98aa
commit
f43d63240d
|
@ -45,24 +45,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class LLImageManagerTests
|
public class LLImageManagerTests
|
||||||
{
|
{
|
||||||
[Test]
|
private AssetBase m_testImageAsset;
|
||||||
public void TestRequestAndSendImage()
|
private LLImageManager llim;
|
||||||
|
private TestClient tc;
|
||||||
|
|
||||||
|
[TestFixtureSetUp]
|
||||||
|
public void FixtureInit()
|
||||||
{
|
{
|
||||||
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 (
|
using (
|
||||||
Stream resource
|
Stream resource
|
||||||
= GetType().Assembly.GetManifestResourceStream(
|
= GetType().Assembly.GetManifestResourceStream(
|
||||||
|
@ -70,14 +59,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
{
|
{
|
||||||
using (BinaryReader br = new BinaryReader(resource))
|
using (BinaryReader br = new BinaryReader(resource))
|
||||||
{
|
{
|
||||||
AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
|
m_testImageAsset
|
||||||
asset.Data = br.ReadBytes(99999999);
|
= new AssetBase(
|
||||||
scene.AssetService.Store(asset);
|
TestHelpers.ParseTail(0x1),
|
||||||
|
"Test Image",
|
||||||
|
(sbyte)AssetType.Texture,
|
||||||
|
TestHelpers.ParseTail(0x2).ToString());
|
||||||
|
|
||||||
|
m_testImageAsset.Data = br.ReadBytes(99999999);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
UUID userId = TestHelpers.ParseTail(0x3);
|
||||||
|
|
||||||
|
J2KDecoderModule j2kdm = new J2KDecoderModule();
|
||||||
|
|
||||||
|
Scene scene = SceneHelpers.SetupScene();
|
||||||
|
SceneHelpers.SetupSceneModules(scene, j2kdm);
|
||||||
|
|
||||||
|
scene.AssetService.Store(m_testImageAsset);
|
||||||
|
|
||||||
|
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
|
||||||
|
llim = new LLImageManager(tc, scene.AssetService, j2kdm);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRequestAndSendImage()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// XmlConfigurator.Configure();
|
||||||
|
|
||||||
TextureRequestArgs args = new TextureRequestArgs();
|
TextureRequestArgs args = new TextureRequestArgs();
|
||||||
args.RequestedAssetID = TestHelpers.ParseTail(0x1);
|
args.RequestedAssetID = m_testImageAsset.FullID;
|
||||||
args.DiscardLevel = 0;
|
args.DiscardLevel = 0;
|
||||||
args.PacketNumber = 1;
|
args.PacketNumber = 1;
|
||||||
args.Priority = 5;
|
args.Priority = 5;
|
||||||
|
@ -95,33 +112,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// XmlConfigurator.Configure();
|
// 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();
|
TextureRequestArgs args = new TextureRequestArgs();
|
||||||
args.RequestedAssetID = imageId;
|
args.RequestedAssetID = m_testImageAsset.FullID;
|
||||||
args.DiscardLevel = 0;
|
args.DiscardLevel = 0;
|
||||||
args.PacketNumber = 1;
|
args.PacketNumber = 1;
|
||||||
args.Priority = 5;
|
args.Priority = 5;
|
||||||
|
@ -130,7 +122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
|
|
||||||
// Now create a discard request
|
// Now create a discard request
|
||||||
TextureRequestArgs discardArgs = new TextureRequestArgs();
|
TextureRequestArgs discardArgs = new TextureRequestArgs();
|
||||||
discardArgs.RequestedAssetID = imageId;
|
discardArgs.RequestedAssetID = m_testImageAsset.FullID;
|
||||||
discardArgs.DiscardLevel = -1;
|
discardArgs.DiscardLevel = -1;
|
||||||
discardArgs.PacketNumber = 1;
|
discardArgs.PacketNumber = 1;
|
||||||
discardArgs.Priority = 0;
|
discardArgs.Priority = 0;
|
||||||
|
|
Loading…
Reference in New Issue