Exemplo n.º 1
0
        public void BlackQuadAddEventShouldBeCalledTwentyTimes()
        {
            var qt = new RegionQuadtree <int>(3);

            qt.Set(1);
            var times = 0;

            qt.OnQuadAdded += (s, a) =>
            {
                times++;
            };

            qt.Unset(new Point2i(0, 0));
            qt.Unset(new Point2i(4, 4));

            Assert.Equal(20, times);
        }
Exemplo n.º 2
0
        public void BlackQuadRemoveEventShouldBeCalledFiveTimes()
        {
            var qt = new RegionQuadtree <int>(3);

            qt.Set(1);
            var times = 0;

            qt.OnQuadRemoving += (s, a) =>
            {
                times++;
            };

            qt.Unset(new Point2i(0, 0));
            qt.Unset(new Point2i(0, 1));

            Assert.Equal(5, times);
        }
Exemplo n.º 3
0
        public void WhiteQuadRemoveEventShouldBeCalledOnce()
        {
            var qt    = new RegionQuadtree <int>(3);
            var times = 0;

            qt.OnQuadRemoving += (s, a) =>
            {
                times++;
            };

            qt.Set(new Point2i(0, 0), 1);
            qt.Unset(new Point2i(0, 0));

            // Remove event should not be called twice
            qt.Unset(new Point2i(0, 0));

            Assert.Equal(1, times);
        }
Exemplo n.º 4
0
        public void BlackQuadAddEventShouldBeCalledTwelveTimes()
        {
            var qt = new RegionQuadtree <int>(3);

            qt.Set(1);
            var times = 0;

            qt.OnQuadAdded += (s, a) =>
            {
                times++;
            };

            qt.Unset(new Point2i(0, 0));

            Assert.Equal(12, times);

            // Remove event should not be called twice
            qt.Unset(new Point2i(0, 0));

            Assert.Equal(12, times);
        }