|
8 | 8 | using Datamodel; |
9 | 9 | using System.Numerics; |
10 | 10 | using DM = Datamodel.Datamodel; |
| 11 | +using System.Text; |
11 | 12 |
|
12 | 13 | namespace Datamodel_Tests |
13 | 14 | { |
@@ -234,6 +235,34 @@ protected DM Create(string encoding, int version, bool memory_save = false) |
234 | 235 | [TestFixture] |
235 | 236 | public class Functionality : DatamodelTests |
236 | 237 | { |
| 238 | + [Test] |
| 239 | + public void Create_Datamodel_Vmap() |
| 240 | + { |
| 241 | + using var datamodel = new DM("vmap", 29); |
| 242 | + datamodel.PrefixAttributes.Add("map_asset_references", new List<string>()); |
| 243 | + datamodel.Root = new Element(datamodel, "root", classNameOverride: "CMapRoot") |
| 244 | + { |
| 245 | + ["isprefab"] = false, |
| 246 | + ["showgrid"] = true, |
| 247 | + ["snaprotationangle"] = 15, |
| 248 | + ["gridspacing"] = 64, |
| 249 | + ["show3dgrid"] = true, |
| 250 | + ["itemFile"] = true, |
| 251 | + ["world"] = new Element(datamodel, "world", classNameOverride: "CMapWorld"), |
| 252 | + }; |
| 253 | + |
| 254 | + using var stream = new MemoryStream(); |
| 255 | + datamodel.Save(stream, "keyvalues2", 4); |
| 256 | + Assert.That(stream.Length, Is.GreaterThan(0)); |
| 257 | + |
| 258 | + using var actual = DM.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, "Resources", "vmaptest1.dmx")); |
| 259 | + |
| 260 | + //Assert.That(actual.PrefixAttributes.ContainsKey("map_asset_references"), Is.True); |
| 261 | + //Assert.That(actual.PrefixAttributes["map_asset_references"], Is.Empty); |
| 262 | + Assert.That(actual.Root, Is.Not.Null); |
| 263 | + Assert.That(actual.Root["world"], Is.Not.Null); |
| 264 | + Assert.That(actual.Root["world"], Is.EqualTo(datamodel.Root["world"])); |
| 265 | + } |
237 | 266 |
|
238 | 267 | [Test] |
239 | 268 | public void Create_Binary_9() |
|
0 commit comments