diff options
author | BlueWall | 2012-01-20 23:54:29 -0500 |
---|---|---|
committer | BlueWall | 2012-01-20 23:54:29 -0500 |
commit | 590f707c425bff6896839d1bf024b4dd83b6d078 (patch) | |
tree | 31eeb5fc8ebb68fd28699c99a03aa6854f1fc5a3 /OpenSim/Region/ClientStack/Linden/UDP/Tests | |
parent | Telehub Support: (diff) | |
parent | Revert "Change linux, windows and mac ODE libraries to use the GIMPACT collid... (diff) | |
download | opensim-SC-590f707c425bff6896839d1bf024b4dd83b6d078.zip opensim-SC-590f707c425bff6896839d1bf024b4dd83b6d078.tar.gz opensim-SC-590f707c425bff6896839d1bf024b4dd83b6d078.tar.bz2 opensim-SC-590f707c425bff6896839d1bf024b4dd83b6d078.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs | 110 |
1 files changed, 89 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index bdc9c7d..1b68d68 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs | |||
@@ -45,24 +45,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class LLImageManagerTests | 46 | public class LLImageManagerTests |
47 | { | 47 | { |
48 | [Test] | 48 | private AssetBase m_testImageAsset; |
49 | public void TestRequestAndSendImage() | 49 | private Scene scene; |
50 | { | 50 | private LLImageManager llim; |
51 | TestHelpers.InMethod(); | 51 | private TestClient tc; |
52 | // XmlConfigurator.Configure(); | ||
53 | |||
54 | UUID imageId = TestHelpers.ParseTail(0x1); | ||
55 | string creatorId = TestHelpers.ParseTail(0x2).ToString(); | ||
56 | UUID userId = TestHelpers.ParseTail(0x3); | ||
57 | |||
58 | J2KDecoderModule j2kdm = new J2KDecoderModule(); | ||
59 | |||
60 | Scene scene = SceneHelpers.SetupScene(); | ||
61 | SceneHelpers.SetupSceneModules(scene, j2kdm); | ||
62 | |||
63 | TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); | ||
64 | LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm); | ||
65 | 52 | ||
53 | [TestFixtureSetUp] | ||
54 | public void FixtureInit() | ||
55 | { | ||
66 | using ( | 56 | using ( |
67 | Stream resource | 57 | Stream resource |
68 | = GetType().Assembly.GetManifestResourceStream( | 58 | = GetType().Assembly.GetManifestResourceStream( |
@@ -70,14 +60,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
70 | { | 60 | { |
71 | using (BinaryReader br = new BinaryReader(resource)) | 61 | using (BinaryReader br = new BinaryReader(resource)) |
72 | { | 62 | { |
73 | AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId); | 63 | m_testImageAsset |
74 | asset.Data = br.ReadBytes(99999999); | 64 | = new AssetBase( |
75 | scene.AssetService.Store(asset); | 65 | TestHelpers.ParseTail(0x1), |
66 | "Test Image", | ||
67 | (sbyte)AssetType.Texture, | ||
68 | TestHelpers.ParseTail(0x2).ToString()); | ||
69 | |||
70 | m_testImageAsset.Data = br.ReadBytes(99999999); | ||
76 | } | 71 | } |
77 | } | 72 | } |
73 | } | ||
74 | |||
75 | [SetUp] | ||
76 | public void SetUp() | ||
77 | { | ||
78 | UUID userId = TestHelpers.ParseTail(0x3); | ||
79 | |||
80 | J2KDecoderModule j2kdm = new J2KDecoderModule(); | ||
81 | |||
82 | scene = SceneHelpers.SetupScene(); | ||
83 | SceneHelpers.SetupSceneModules(scene, j2kdm); | ||
84 | |||
85 | tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); | ||
86 | llim = new LLImageManager(tc, scene.AssetService, j2kdm); | ||
87 | } | ||
88 | |||
89 | [Test] | ||
90 | public void TestSendImage() | ||
91 | { | ||
92 | TestHelpers.InMethod(); | ||
93 | // XmlConfigurator.Configure(); | ||
94 | |||
95 | scene.AssetService.Store(m_testImageAsset); | ||
78 | 96 | ||
79 | TextureRequestArgs args = new TextureRequestArgs(); | 97 | TextureRequestArgs args = new TextureRequestArgs(); |
80 | args.RequestedAssetID = TestHelpers.ParseTail(0x1); | 98 | args.RequestedAssetID = m_testImageAsset.FullID; |
81 | args.DiscardLevel = 0; | 99 | args.DiscardLevel = 0; |
82 | args.PacketNumber = 1; | 100 | args.PacketNumber = 1; |
83 | args.Priority = 5; | 101 | args.Priority = 5; |
@@ -88,5 +106,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests | |||
88 | 106 | ||
89 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); | 107 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); |
90 | } | 108 | } |
109 | |||
110 | [Test] | ||
111 | public void TestDiscardImage() | ||
112 | { | ||
113 | TestHelpers.InMethod(); | ||
114 | // XmlConfigurator.Configure(); | ||
115 | |||
116 | scene.AssetService.Store(m_testImageAsset); | ||
117 | |||
118 | TextureRequestArgs args = new TextureRequestArgs(); | ||
119 | args.RequestedAssetID = m_testImageAsset.FullID; | ||
120 | args.DiscardLevel = 0; | ||
121 | args.PacketNumber = 1; | ||
122 | args.Priority = 5; | ||
123 | args.requestSequence = 1; | ||
124 | llim.EnqueueReq(args); | ||
125 | |||
126 | // Now create a discard request | ||
127 | TextureRequestArgs discardArgs = new TextureRequestArgs(); | ||
128 | discardArgs.RequestedAssetID = m_testImageAsset.FullID; | ||
129 | discardArgs.DiscardLevel = -1; | ||
130 | discardArgs.PacketNumber = 1; | ||
131 | discardArgs.Priority = 0; | ||
132 | discardArgs.requestSequence = 2; | ||
133 | llim.EnqueueReq(discardArgs); | ||
134 | |||
135 | llim.ProcessImageQueue(20); | ||
136 | |||
137 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); | ||
138 | } | ||
139 | |||
140 | [Test] | ||
141 | public void TestMissingImage() | ||
142 | { | ||
143 | TestHelpers.InMethod(); | ||
144 | // XmlConfigurator.Configure(); | ||
145 | |||
146 | TextureRequestArgs args = new TextureRequestArgs(); | ||
147 | args.RequestedAssetID = m_testImageAsset.FullID; | ||
148 | args.DiscardLevel = 0; | ||
149 | args.PacketNumber = 1; | ||
150 | args.Priority = 5; | ||
151 | args.requestSequence = 1; | ||
152 | |||
153 | llim.EnqueueReq(args); | ||
154 | llim.ProcessImageQueue(20); | ||
155 | |||
156 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); | ||
157 | Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1)); | ||
158 | } | ||
91 | } | 159 | } |
92 | } \ No newline at end of file | 160 | } \ No newline at end of file |