public void TestDrawingGroupExists() { EscherDggRecord dgg = new EscherDggRecord(); dgg.DrawingsSaved=(1); dgg.FileIdClusters=(new EscherDggRecord.FileIdCluster[]{ new EscherDggRecord.FileIdCluster( 2, 10 )}); DrawingManager dm = new DrawingManager(dgg); Assert.IsFalse(dm.DrawingGroupExists((short)1)); Assert.IsTrue(dm.DrawingGroupExists((short)2)); Assert.IsFalse(dm.DrawingGroupExists((short)3)); }
public void TestFindFreeSPIDBlock() { EscherDggRecord dgg = new EscherDggRecord(); DrawingManager dm = new DrawingManager(dgg); dgg.ShapeIdMax = (1024); Assert.AreEqual(2048, dm.FindFreeSPIDBlock()); dgg.ShapeIdMax = (1025); Assert.AreEqual(2048, dm.FindFreeSPIDBlock()); dgg.ShapeIdMax = (2047); Assert.AreEqual(2048, dm.FindFreeSPIDBlock()); }
public void TestFindNewDrawingGroupId() { EscherDggRecord dgg = new EscherDggRecord(); dgg.DrawingsSaved=(1); dgg.FileIdClusters=(new EscherDggRecord.FileIdCluster[]{ new EscherDggRecord.FileIdCluster( 2, 10 )}); DrawingManager dm = new DrawingManager(dgg); Assert.AreEqual(1, dm.FindNewDrawingGroupId()); dgg.FileIdClusters=(new EscherDggRecord.FileIdCluster[]{ new EscherDggRecord.FileIdCluster( 1, 10 ), new EscherDggRecord.FileIdCluster( 2, 10 )}); Assert.AreEqual(3, dm.FindNewDrawingGroupId()); }
public void TestCreateDgRecord() { EscherDggRecord dgg = new EscherDggRecord(); dgg.DrawingsSaved=(0); dgg.FileIdClusters=(new EscherDggRecord.FileIdCluster[] { }); DrawingManager dm = new DrawingManager(dgg); EscherDgRecord dgRecord = dm.CreateDgRecord(); Assert.AreEqual(-1, dgRecord.LastMSOSPID); Assert.AreEqual(0, dgRecord.NumShapes); Assert.AreEqual(1, dm.Dgg.DrawingsSaved); Assert.AreEqual(1, dm.Dgg.FileIdClusters.Length); Assert.AreEqual(1, dm.Dgg.FileIdClusters[0].DrawingGroupId); Assert.AreEqual(0, dm.Dgg.FileIdClusters[0].NumShapeIdsUsed); }
public void TestAllocateShapeId() { EscherDggRecord dgg = new EscherDggRecord(); dgg.DrawingsSaved=(0); dgg.FileIdClusters=(new EscherDggRecord.FileIdCluster[] { }); DrawingManager dm = new DrawingManager(dgg); EscherDgRecord dg = dm.CreateDgRecord(); int shapeId = dm.AllocateShapeId(dg.DrawingGroupId); Assert.AreEqual(1024, shapeId); Assert.AreEqual(1025, dgg.ShapeIdMax); Assert.AreEqual(1, dgg.DrawingsSaved); Assert.AreEqual(1, dgg.FileIdClusters[0].DrawingGroupId); Assert.AreEqual(1, dgg.FileIdClusters[0].NumShapeIdsUsed); Assert.AreEqual(1024, dg.LastMSOSPID); Assert.AreEqual(1, dg.NumShapes); }