Example #1
0
        public void FirstTileSetJsonTests()
        {
            // arrange
            var zUpBoxes              = BBTestDataReader.GetTestData("testfixtures/zupboxes_actual.txt");
            var tree                  = TileCutter.ConstructTree(zUpBoxes, 50, 2000.0);
            var translation           = new double[] { 141584.2745, 471164.637, 15.81555842685751 };
            var s                     = File.ReadAllText(@"./testfixtures/tileset_json_expected.json");
            var tileset_json_expected = JsonConvert.DeserializeObject <TileSet>(s);

            // act
            var tileset_json_actual = TreeSerializer.ToTileset(tree, translation);
            var actual_json         = JsonConvert.SerializeObject(tileset_json_actual, Formatting.Indented, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            //File.WriteAllText("d:/aaa/sample_tileset_actual.json", actual_json);

            // assert
            Assert.IsTrue(tileset_json_actual.asset.version == "1.0");
            Assert.IsTrue(tileset_json_actual.geometricError == 500);

            var all_children_actual   = GetAllChildren(tileset_json_actual.root);
            var all_children_expected = GetAllChildren(tileset_json_expected.root);
            var res = AreSimilar(all_children_actual, all_children_expected);

            var sim = IsSimilar(tileset_json_expected.root, tileset_json_actual.root);

            Assert.IsTrue(sim);
            Assert.IsTrue(tileset_json_actual.root.refine == "ADD");        // 500
            Assert.IsTrue(tileset_json_actual.root.geometricError == 500);  // 500
            Assert.IsTrue(tileset_json_actual.root.transform.Length == 16); // 500
            Assert.IsTrue(tileset_json_actual.root.boundingVolume.box.Length == 12);
            Assert.IsTrue(tileset_json_actual.root.children.Count == 1);
        }
Example #2
0
        public void BoxesTestDataTest()
        {
            var boxes_actual   = BBTestDataReader.GetTestData("testfixtures/bboxes_actual.txt");
            var boxes_expected = BBTestDataReader.GetTestData("testfixtures/bboxes_expected.txt");

            for (var i = 0; i < boxes_actual.Count; i++)
            {
                var box_act    = boxes_actual[i];
                var box_expect = boxes_expected[i];
                Assert.IsTrue(box_act.Equals(box_expect));
            }
        }