예제 #1
0
        public void AddRange_Merge_Overlaping()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 5, 1))
                                     .AddRange(new Range(3, 1, 8, 1));

            Assert.AreEqual(1, list.GetSelectedRowRegions(0, 1).Count);
            Assert.AreEqual(new Range(1, 0, 8, 1), list.GetSelectedRowRegions(0, 1)[0]);
        }
예제 #2
0
        public void AddRange_Merge_Intersecting()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 1, 1))
                                     .AddRange(new Range(1, 1, 2, 2));

            Assert.AreEqual(1, list.GetSelectedRowRegions(0, 1).Count);
            Assert.AreEqual(new Range(1, 0, 2, 1), list.GetSelectedRowRegions(0, 1)[0]);
        }
예제 #3
0
        public void RemoveRange_ResizeFromBottom()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 2, 1))
                                     .RemoveRange(new Range(1, 1, 1, 1));

            Assert.AreEqual(1, list.GetSelectedRowRegions(0, 1).Count);
            Assert.AreEqual(new Range(2, 0, 2, 1), list.GetSelectedRowRegions(0, 1)[0]);
        }
예제 #4
0
        public void RemoveRange_SplitIntoTwo()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 3, 1))
                                     .RemoveRange(new Range(2, 1, 2, 1));

            Assert.AreEqual(2, list.GetSelectedRowRegions(0, 1).Count);
            Assert.AreEqual(new Range(1, 0, 1, 1), list.GetSelectedRowRegions(0, 1)[0]);
            Assert.AreEqual(new Range(3, 0, 3, 1), list.GetSelectedRowRegions(0, 1)[1]);
        }
예제 #5
0
        public void AddRange_Merge_WhenOverlapped()
        {
            // single addition causes to range many rows at once

            // add separate ranges
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 1, 1))
                                     .AddRange(new Range(3, 3, 3, 3))
                                     .AddRange(new Range(5, 5, 5, 5));

            Assert.AreEqual(3, list.GetSelectedRowRegions(0, 1).Count);

            // cause them all to merge
            list.AddRange(new Range(1, 1, 5, 1));
            Assert.AreEqual(1, list.GetSelectedRowRegions(0, 1).Count);
        }
예제 #6
0
        public void AddRange_NotMerge()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 1, 1))
                                     .AddRange(new Range(3, 3, 3, 3));

            Assert.AreEqual(2, list.GetSelectedRowRegions(0, 1).Count);
        }
예제 #7
0
        public void RemoveRange_RemoveFromTopAndBottom()
        {
            RangeMergerByRows list = new RangeMergerByRows()
                                     .AddRange(new Range(1, 1, 2, 1))
                                     .AddRange(new Range(4, 1, 5, 1))
                                     .RemoveRange(new Range(2, 1, 4, 1));

            List <Range> ranges = list.GetSelectedRowRegions(0, 1);

            Assert.AreEqual(2, ranges.Count);
            Assert.AreEqual(new Range(1, 0, 1, 1), ranges[0]);
            Assert.AreEqual(new Range(5, 0, 5, 1), ranges[1]);
        }