private void GenerateTestHierarchicalReferenceFile(string path, double width, double height) { // Generate reference hierarchical data with layout info var generator = new HierarchicalDataBuilder(); var root = generator.GenerateRandomHierarchy(); // Needed by tree map algorithm root.SumAreaMetrics(); var layout = new SquarifiedTreeMapLayout(); layout.Layout(root, width, height); var file = new BinaryFile <HierarchicalData>(); file.Write(path, root); }
private static void AssertLayouting(string path, double width, double height) { var layout = new SquarifiedTreeMapLayout(); var binFile = new BinaryFile <HierarchicalData>(); var data = binFile.Read(path); // Includes layout info var reference = data.Dump(); Assert.IsTrue(File.Exists(path)); var clone = (HierarchicalData)data.Clone(); // Clone does not copy the layout. layout.Layout(clone, width, height); var result = clone.Dump(); Assert.AreEqual(reference, result); }