diff options
author | Justin Clark-Casey (justincc) | 2012-02-16 02:58:00 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-16 02:58:00 +0000 |
commit | 2b842958cc172fbf9ee79b495a268f012fb47cdc (patch) | |
tree | 5d9e5f2374df7b15a4b77310afe4b1b5bef7ac40 /OpenSim/Region/CoreModules | |
parent | Correct a bug introduced in 1f402fdf (Feb 7 2012) where the delete friends gr... (diff) | |
download | opensim-SC-2b842958cc172fbf9ee79b495a268f012fb47cdc.zip opensim-SC-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.gz opensim-SC-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.bz2 opensim-SC-2b842958cc172fbf9ee79b495a268f012fb47cdc.tar.xz |
If shape properties fail SOP parsing (e.g. due to commas instead of decimal points) print out one short message listing the failing node names rather than lots of exceptions.
Adds skeleton bad float values deserialization test
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index d5b585a..9c8c4d5 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -148,6 +148,113 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
148 | <OtherParts /> | 148 | <OtherParts /> |
149 | </SceneObjectGroup>"; | 149 | </SceneObjectGroup>"; |
150 | 150 | ||
151 | private string badFloatsXml = @" | ||
152 | <SceneObjectGroup> | ||
153 | <RootPart> | ||
154 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | ||
155 | <AllowedDrop>false</AllowedDrop> | ||
156 | <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID> | ||
157 | <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID> | ||
158 | <InventorySerial>1</InventorySerial> | ||
159 | <TaskInventory /> | ||
160 | <ObjectFlags>0</ObjectFlags> | ||
161 | <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID> | ||
162 | <LocalId>2698615125</LocalId> | ||
163 | <Name>NaughtyPrim</Name> | ||
164 | <Material>0</Material> | ||
165 | <PassTouches>false</PassTouches> | ||
166 | <RegionHandle>1099511628032000</RegionHandle> | ||
167 | <ScriptAccessPin>0</ScriptAccessPin> | ||
168 | <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition> | ||
169 | <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition> | ||
170 | <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset> | ||
171 | <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity> | ||
172 | <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity> | ||
173 | <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity> | ||
174 | <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration> | ||
175 | <Description /> | ||
176 | <Color /> | ||
177 | <Text /> | ||
178 | <SitName /> | ||
179 | <TouchName /> | ||
180 | <LinkNum>0</LinkNum> | ||
181 | <ClickAction>0</ClickAction> | ||
182 | <Shape> | ||
183 | <ProfileCurve>1</ProfileCurve> | ||
184 | <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry> | ||
185 | <ExtraParams>AA==</ExtraParams> | ||
186 | <PathBegin>0</PathBegin> | ||
187 | <PathCurve>16</PathCurve> | ||
188 | <PathEnd>0</PathEnd> | ||
189 | <PathRadiusOffset>0</PathRadiusOffset> | ||
190 | <PathRevolutions>0</PathRevolutions> | ||
191 | <PathScaleX>100</PathScaleX> | ||
192 | <PathScaleY>100</PathScaleY> | ||
193 | <PathShearX>0</PathShearX> | ||
194 | <PathShearY>0</PathShearY> | ||
195 | <PathSkew>0</PathSkew> | ||
196 | <PathTaperX>0</PathTaperX> | ||
197 | <PathTaperY>0</PathTaperY> | ||
198 | <PathTwist>0</PathTwist> | ||
199 | <PathTwistBegin>0</PathTwistBegin> | ||
200 | <PCode>9</PCode> | ||
201 | <ProfileBegin>0</ProfileBegin> | ||
202 | <ProfileEnd>0</ProfileEnd> | ||
203 | <ProfileHollow>0</ProfileHollow> | ||
204 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | ||
205 | <State>0</State> | ||
206 | <ProfileShape>Square</ProfileShape> | ||
207 | <HollowShape>Same</HollowShape> | ||
208 | <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture> | ||
209 | <SculptType>0</SculptType><SculptData /> | ||
210 | <FlexiSoftness>0</FlexiSoftness> | ||
211 | <FlexiTension>0,5</FlexiTension> | ||
212 | <FlexiDrag>yo mamma</FlexiDrag> | ||
213 | <FlexiGravity>0</FlexiGravity> | ||
214 | <FlexiWind>0</FlexiWind> | ||
215 | <FlexiForceX>0</FlexiForceX> | ||
216 | <FlexiForceY>0</FlexiForceY> | ||
217 | <FlexiForceZ>0</FlexiForceZ> | ||
218 | <LightColorR>0</LightColorR> | ||
219 | <LightColorG>0</LightColorG> | ||
220 | <LightColorB>0</LightColorB> | ||
221 | <LightColorA>1</LightColorA> | ||
222 | <LightRadius>0</LightRadius> | ||
223 | <LightCutoff>0</LightCutoff> | ||
224 | <LightFalloff>0</LightFalloff> | ||
225 | <LightIntensity>1</LightIntensity> | ||
226 | <FlexiEntry>false</FlexiEntry> | ||
227 | <LightEntry>false</LightEntry> | ||
228 | <SculptEntry>false</SculptEntry> | ||
229 | </Shape> | ||
230 | <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> | ||
231 | <UpdateFlag>0</UpdateFlag> | ||
232 | <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation> | ||
233 | <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition> | ||
234 | <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL> | ||
235 | <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL> | ||
236 | <ParentID>0</ParentID> | ||
237 | <CreationDate>1211330445</CreationDate> | ||
238 | <Category>0</Category> | ||
239 | <SalePrice>0</SalePrice> | ||
240 | <ObjectSaleType>0</ObjectSaleType> | ||
241 | <OwnershipCost>0</OwnershipCost> | ||
242 | <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID> | ||
243 | <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID> | ||
244 | <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID> | ||
245 | <BaseMask>2147483647</BaseMask> | ||
246 | <OwnerMask>2147483647</OwnerMask> | ||
247 | <GroupMask>0</GroupMask> | ||
248 | <EveryoneMask>0</EveryoneMask> | ||
249 | <NextOwnerMask>2147483647</NextOwnerMask> | ||
250 | <Flags>None</Flags> | ||
251 | <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> | ||
252 | <CollisionSoundVolume>0</CollisionSoundVolume> | ||
253 | </SceneObjectPart> | ||
254 | </RootPart> | ||
255 | <OtherParts /> | ||
256 | </SceneObjectGroup>"; | ||
257 | |||
151 | private string xml2 = @" | 258 | private string xml2 = @" |
152 | <SceneObjectGroup> | 259 | <SceneObjectGroup> |
153 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> | 260 | <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> |
@@ -257,6 +364,32 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
257 | } | 364 | } |
258 | 365 | ||
259 | [Test] | 366 | [Test] |
367 | public void TestDeserializeBadFloatsXml() | ||
368 | { | ||
369 | TestHelpers.InMethod(); | ||
370 | log4net.Config.XmlConfigurator.Configure(); | ||
371 | |||
372 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml); | ||
373 | SceneObjectPart rootPart = so.RootPart; | ||
374 | |||
375 | Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); | ||
376 | Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); | ||
377 | Assert.That(rootPart.Name, Is.EqualTo("NaughtyPrim")); | ||
378 | |||
379 | // This terminates the deserialization earlier if couldn't be parsed. | ||
380 | // TODO: Need to address this | ||
381 | Assert.That(rootPart.GroupPosition.X, Is.EqualTo(147.23f)); | ||
382 | |||
383 | Assert.That(rootPart.Shape.PathCurve, Is.EqualTo(16)); | ||
384 | |||
385 | // Defaults for bad parses | ||
386 | Assert.That(rootPart.Shape.FlexiTension, Is.EqualTo(0)); | ||
387 | Assert.That(rootPart.Shape.FlexiDrag, Is.EqualTo(0)); | ||
388 | |||
389 | // TODO: Check other properties | ||
390 | } | ||
391 | |||
392 | [Test] | ||
260 | public void TestSerializeXml() | 393 | public void TestSerializeXml() |
261 | { | 394 | { |
262 | TestHelpers.InMethod(); | 395 | TestHelpers.InMethod(); |