diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | 239 |
1 files changed, 229 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index 9787c8c..b50c0bd 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | |||
@@ -45,31 +45,250 @@ using OpenSim.Tests.Common.Mock; | |||
45 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | 45 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests |
46 | { | 46 | { |
47 | [TestFixture] | 47 | [TestFixture] |
48 | public class VectorRenderModuleTests | 48 | public class VectorRenderModuleTests : OpenSimTestCase |
49 | { | 49 | { |
50 | Scene m_scene; | ||
51 | DynamicTextureModule m_dtm; | ||
52 | VectorRenderModule m_vrm; | ||
53 | |||
54 | private void SetupScene(bool reuseTextures) | ||
55 | { | ||
56 | m_scene = new SceneHelpers().SetupScene(); | ||
57 | |||
58 | m_dtm = new DynamicTextureModule(); | ||
59 | m_dtm.ReuseTextures = reuseTextures; | ||
60 | |||
61 | m_vrm = new VectorRenderModule(); | ||
62 | |||
63 | SceneHelpers.SetupSceneModules(m_scene, m_dtm, m_vrm); | ||
64 | } | ||
65 | |||
50 | [Test] | 66 | [Test] |
51 | public void TestDraw() | 67 | public void TestDraw() |
52 | { | 68 | { |
53 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
54 | 70 | ||
55 | Scene scene = new SceneHelpers().SetupScene(); | 71 | SetupScene(false); |
56 | DynamicTextureModule dtm = new DynamicTextureModule(); | 72 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); |
57 | VectorRenderModule vrm = new VectorRenderModule(); | ||
58 | SceneHelpers.SetupSceneModules(scene, dtm, vrm); | ||
59 | |||
60 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); | ||
61 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | 73 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; |
62 | 74 | ||
63 | dtm.AddDynamicTextureData( | 75 | m_dtm.AddDynamicTextureData( |
64 | scene.RegionInfo.RegionID, | 76 | m_scene.RegionInfo.RegionID, |
65 | so.UUID, | 77 | so.UUID, |
66 | vrm.GetContentType(), | 78 | m_vrm.GetContentType(), |
67 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", | 79 | "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", |
68 | "", | 80 | "", |
69 | 0); | 81 | 0); |
70 | 82 | ||
83 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
84 | } | ||
85 | |||
86 | [Test] | ||
87 | public void TestRepeatSameDraw() | ||
88 | { | ||
89 | TestHelpers.InMethod(); | ||
90 | |||
91 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | ||
92 | |||
93 | SetupScene(false); | ||
94 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
95 | |||
96 | m_dtm.AddDynamicTextureData( | ||
97 | m_scene.RegionInfo.RegionID, | ||
98 | so.UUID, | ||
99 | m_vrm.GetContentType(), | ||
100 | dtText, | ||
101 | "", | ||
102 | 0); | ||
103 | |||
104 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
105 | |||
106 | m_dtm.AddDynamicTextureData( | ||
107 | m_scene.RegionInfo.RegionID, | ||
108 | so.UUID, | ||
109 | m_vrm.GetContentType(), | ||
110 | dtText, | ||
111 | "", | ||
112 | 0); | ||
113 | |||
114 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
115 | } | ||
116 | |||
117 | [Test] | ||
118 | public void TestRepeatSameDrawDifferentExtraParams() | ||
119 | { | ||
120 | TestHelpers.InMethod(); | ||
121 | |||
122 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | ||
123 | |||
124 | SetupScene(false); | ||
125 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
126 | |||
127 | m_dtm.AddDynamicTextureData( | ||
128 | m_scene.RegionInfo.RegionID, | ||
129 | so.UUID, | ||
130 | m_vrm.GetContentType(), | ||
131 | dtText, | ||
132 | "", | ||
133 | 0); | ||
134 | |||
135 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
136 | |||
137 | m_dtm.AddDynamicTextureData( | ||
138 | m_scene.RegionInfo.RegionID, | ||
139 | so.UUID, | ||
140 | m_vrm.GetContentType(), | ||
141 | dtText, | ||
142 | "alpha:250", | ||
143 | 0); | ||
144 | |||
145 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
146 | } | ||
147 | |||
148 | [Test] | ||
149 | public void TestRepeatSameDrawContainingImage() | ||
150 | { | ||
151 | TestHelpers.InMethod(); | ||
152 | |||
153 | string dtText | ||
154 | = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png"; | ||
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); | ||
71 | 196 | ||
72 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 197 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
73 | } | 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); | ||
271 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
272 | |||
273 | m_dtm.AddDynamicTextureData( | ||
274 | m_scene.RegionInfo.RegionID, | ||
275 | so.UUID, | ||
276 | m_vrm.GetContentType(), | ||
277 | dtText, | ||
278 | "", | ||
279 | 0); | ||
280 | |||
281 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
282 | |||
283 | m_dtm.AddDynamicTextureData( | ||
284 | m_scene.RegionInfo.RegionID, | ||
285 | so.UUID, | ||
286 | m_vrm.GetContentType(), | ||
287 | dtText, | ||
288 | "", | ||
289 | 0); | ||
290 | |||
291 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
292 | } | ||
74 | } | 293 | } |
75 | } \ No newline at end of file | 294 | } \ No newline at end of file |