diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | 125 |
1 files changed, 123 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index 180ea9f..b50c0bd 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | |||
@@ -51,12 +51,15 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
51 | DynamicTextureModule m_dtm; | 51 | DynamicTextureModule m_dtm; |
52 | VectorRenderModule m_vrm; | 52 | VectorRenderModule m_vrm; |
53 | 53 | ||
54 | [SetUp] | 54 | private void SetupScene(bool reuseTextures) |
55 | public void SetUp() | ||
56 | { | 55 | { |
57 | m_scene = new SceneHelpers().SetupScene(); | 56 | m_scene = new SceneHelpers().SetupScene(); |
57 | |||
58 | m_dtm = new DynamicTextureModule(); | 58 | m_dtm = new DynamicTextureModule(); |
59 | m_dtm.ReuseTextures = reuseTextures; | ||
60 | |||
59 | m_vrm = new VectorRenderModule(); | 61 | m_vrm = new VectorRenderModule(); |
62 | |||
60 | SceneHelpers.SetupSceneModules(m_scene, m_dtm, m_vrm); | 63 | SceneHelpers.SetupSceneModules(m_scene, m_dtm, m_vrm); |
61 | } | 64 | } |
62 | 65 | ||
@@ -65,6 +68,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
65 | { | 68 | { |
66 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
67 | 70 | ||
71 | SetupScene(false); | ||
68 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 72 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
69 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 73 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
70 | 74 | ||
@@ -86,6 +90,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
86 | 90 | ||
87 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | 91 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; |
88 | 92 | ||
93 | SetupScene(false); | ||
89 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 94 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
90 | 95 | ||
91 | m_dtm.AddDynamicTextureData( | 96 | m_dtm.AddDynamicTextureData( |
@@ -116,6 +121,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
116 | 121 | ||
117 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | 122 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; |
118 | 123 | ||
124 | SetupScene(false); | ||
119 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 125 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
120 | 126 | ||
121 | m_dtm.AddDynamicTextureData( | 127 | m_dtm.AddDynamicTextureData( |
@@ -147,6 +153,121 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
147 | string dtText | 153 | string dtText |
148 | = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png"; | 154 | = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png"; |
149 | 155 | ||
156 | SetupScene(false); | ||
157 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
158 | |||
159 | m_dtm.AddDynamicTextureData( | ||
160 | m_scene.RegionInfo.RegionID, | ||
161 | so.UUID, | ||
162 | m_vrm.GetContentType(), | ||
163 | dtText, | ||
164 | "", | ||
165 | 0); | ||
166 | |||
167 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
168 | |||
169 | m_dtm.AddDynamicTextureData( | ||
170 | m_scene.RegionInfo.RegionID, | ||
171 | so.UUID, | ||
172 | m_vrm.GetContentType(), | ||
173 | dtText, | ||
174 | "", | ||
175 | 0); | ||
176 | |||
177 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
178 | } | ||
179 | |||
180 | [Test] | ||
181 | public void TestDrawReusingTexture() | ||
182 | { | ||
183 | TestHelpers.InMethod(); | ||
184 | |||
185 | SetupScene(true); | ||
186 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
187 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
188 | |||
189 | m_dtm.AddDynamicTextureData( | ||
190 | m_scene.RegionInfo.RegionID, | ||
191 | so.UUID, | ||
192 | m_vrm.GetContentType(), | ||
193 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | ||
194 | "", | ||
195 | 0); | ||
196 | |||
197 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
198 | } | ||
199 | |||
200 | [Test] | ||
201 | public void TestRepeatSameDrawReusingTexture() | ||
202 | { | ||
203 | TestHelpers.InMethod(); | ||
204 | |||
205 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | ||
206 | |||
207 | SetupScene(true); | ||
208 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
209 | |||
210 | m_dtm.AddDynamicTextureData( | ||
211 | m_scene.RegionInfo.RegionID, | ||
212 | so.UUID, | ||
213 | m_vrm.GetContentType(), | ||
214 | dtText, | ||
215 | "", | ||
216 | 0); | ||
217 | |||
218 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
219 | |||
220 | m_dtm.AddDynamicTextureData( | ||
221 | m_scene.RegionInfo.RegionID, | ||
222 | so.UUID, | ||
223 | m_vrm.GetContentType(), | ||
224 | dtText, | ||
225 | "", | ||
226 | 0); | ||
227 | |||
228 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
229 | } | ||
230 | |||
231 | [Test] | ||
232 | public void TestRepeatSameDrawDifferentExtraParamsReusingTexture() | ||
233 | { | ||
234 | TestHelpers.InMethod(); | ||
235 | |||
236 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | ||
237 | |||
238 | SetupScene(true); | ||
239 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
240 | |||
241 | m_dtm.AddDynamicTextureData( | ||
242 | m_scene.RegionInfo.RegionID, | ||
243 | so.UUID, | ||
244 | m_vrm.GetContentType(), | ||
245 | dtText, | ||
246 | "", | ||
247 | 0); | ||
248 | |||
249 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
250 | |||
251 | m_dtm.AddDynamicTextureData( | ||
252 | m_scene.RegionInfo.RegionID, | ||
253 | so.UUID, | ||
254 | m_vrm.GetContentType(), | ||
255 | dtText, | ||
256 | "alpha:250", | ||
257 | 0); | ||
258 | |||
259 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
260 | } | ||
261 | |||
262 | [Test] | ||
263 | public void TestRepeatSameDrawContainingImageReusingTexture() | ||
264 | { | ||
265 | TestHelpers.InMethod(); | ||
266 | |||
267 | string dtText | ||
268 | = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png"; | ||
269 | |||
270 | SetupScene(true); | ||
150 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | 271 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
151 | 272 | ||
152 | m_dtm.AddDynamicTextureData( | 273 | m_dtm.AddDynamicTextureData( |