public void TestRecordSize()
        {
            ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
            agg.InsertColumn(CreateColInfo(1, 3));
            agg.InsertColumn(CreateColInfo(4, 7));
            agg.InsertColumn(CreateColInfo(8, 8));
            agg.GroupColumnRange(2, 5, true);
            Assert.AreEqual(4, agg.NumColumns);

            ConfirmSerializedSize(agg);

            agg = new ColumnInfoRecordsAggregate();
            agg.GroupColumnRange(3, 6, true);
            ConfirmSerializedSize(agg);
        }
 public void TestGroupColumns_bug45639()
 {
     ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
     agg.GroupColumnRange(7, 9, true);
     agg.GroupColumnRange(4, 12, true);
     try
     {
         agg.GroupColumnRange(1, 15, true);
     }
     catch (IndexOutOfRangeException)
     {
         throw new AssertionException("Identified bug 45639");
     }
     ColumnInfoRecord[] cirs = CIRCollector.GetRecords(agg);
     Assert.AreEqual(5, cirs.Length);
     ConfirmCIR(cirs, 0, 1, 3, 1, false, false);
     ConfirmCIR(cirs, 1, 4, 6, 2, false, false);
     ConfirmCIR(cirs, 2, 7, 9, 3, false, false);
     ConfirmCIR(cirs, 3, 10, 12, 2, false, false);
     ConfirmCIR(cirs, 4, 13, 15, 1, false, false);
 }
        public void TestHiddenAfterExpanding()
        {
            ColumnInfoRecordsAggregate agg = new ColumnInfoRecordsAggregate();
            agg.GroupColumnRange(1, 15, true);
            agg.GroupColumnRange(4, 12, true);

            ColumnInfoRecord[] cirs;

            // collapse both inner and outer Groups
            agg.CollapseColumn(6);
            agg.CollapseColumn(3);

            cirs = CIRCollector.GetRecords(agg);
            Assert.AreEqual(5, cirs.Length);
            ConfirmCIR(cirs, 0, 1, 3, 1, true, false);
            ConfirmCIR(cirs, 1, 4, 12, 2, true, false);
            ConfirmCIR(cirs, 2, 13, 13, 1, true, true);
            ConfirmCIR(cirs, 3, 14, 15, 1, true, false);
            ConfirmCIR(cirs, 4, 16, 16, 0, false, true);

            // just expand the inner Group
            agg.ExpandColumn(6);

            cirs = CIRCollector.GetRecords(agg);
            Assert.AreEqual(4, cirs.Length);
            if (!cirs[1].IsHidden)
            {
                throw new AssertionException("Inner Group should still be hidden");
            }
            ConfirmCIR(cirs, 0, 1, 3, 1, true, false);
            ConfirmCIR(cirs, 1, 4, 12, 2, true, false);
            ConfirmCIR(cirs, 2, 13, 15, 1, true, false);
            ConfirmCIR(cirs, 3, 16, 16, 0, false, true);
        }