Esempio n. 1
0
        public void PositionerHasSlotTest()
        {
            var pos = new NotificationPositioner <string>();

            pos.Update(new Rect(0, 50, 800, 650), NotificationPosition.TopRight, 3);
            pos.Add("item1", 200, 100);
            Assert.AreEqual(true, pos.HasEmptySlot());
            pos.Remove("item1");
            Assert.AreEqual(true, pos.HasEmptySlot());
            pos.Add("item2", 200, 100);
            Assert.AreEqual(true, pos.HasEmptySlot());
            pos.Add("item3", 200, 100);
            Assert.AreEqual(true, pos.HasEmptySlot());
            pos.Add("item4", 200, 100);
            Assert.AreEqual(false, pos.HasEmptySlot());
        }
Esempio n. 2
0
        public void PositionerTest3()
        {
            var pos = new NotificationPositioner <string>();

            pos.Update(new Rect(10, 25, 790, 575), NotificationPosition.TopRight, 100);
            Point p = pos.Add("item1", 200, 100);

            Assert.AreEqual(10 + 790 - 200, p.X);
            Assert.AreEqual(25 + 20, p.Y);

            pos = new NotificationPositioner <string>();
            pos.Update(new Rect(10, 25, 790, 575), NotificationPosition.BottomRight, 100);
            p = pos.Add("item1", 200, 100);
            Assert.AreEqual(10 + 790 - 200, p.X);
            Assert.AreEqual(600 - 20 - 100, p.Y);
        }
        public void PositionUpdateTest()
        {
            var pos = new NotificationPositioner <string>();

            pos.Update(new Rect(0, 0, 800, 600), NotificationPosition.TopRight, 3);
            Point p;

            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20, p.Y);

            pos.Update(new Rect(0, 0, 800, 600), NotificationPosition.BottomRight, 3);

            p = pos.GetItemPosition("item1");
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 20 - 50, p.Y);
        }
        public void PositionerTest2() {
            var pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 480);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 460);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 250), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 100);
            pos.Add("item1", 200, 100);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 360), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 100);
            pos.Add("item1", 200, 100);
            Assert.AreEqual(true, pos.HasEmptySlot());
        }
        public void PositionUpdateTest() {
            var pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.TopRight, 3);
            Point p;

            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20, p.Y);

            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.BottomRight, 3);

            p = pos.GetItemPosition("item1");
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 20 - 50, p.Y);
        }
        public void PositionerTest() {
            var pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.TopRight, 3);
            Point p;

            Assert.AreEqual(true, pos.HasEmptySlot());

            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20, p.Y);

            p = pos.Add("item2", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10, p.Y);

            p = pos.Add("item3", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10 + 50 + 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());

            pos.Remove("item2");
            p = pos.Add("item4", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10, p.Y);

            pos.Remove("item3");
            p = pos.Add("item5", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10 + 50 + 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());
            pos.Remove("item1");
            Assert.AreEqual(true, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(0, 0, 800, 600), NotificationPosition.BottomRight, 3);
            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20, p.Y);

            p = pos.Add("item2", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10, p.Y);

            p = pos.Add("item3", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10 - 50 - 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());

            pos.Remove("item2");
            p = pos.Add("item4", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10, p.Y);

            pos.Remove("item3");
            p = pos.Add("item5", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10 - 50 - 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());
            pos.Remove("item1");
            Assert.AreEqual(true, pos.HasEmptySlot());
        }
 public void PositionerHasSlotTest() {
     var pos = new NotificationPositioner<string>();
     pos.Update(new System.Drawing.Rectangle(0, 50, 800, 650), NotificationPosition.TopRight, 3);
     pos.Add("item1", 200, 100);
     Assert.AreEqual(true, pos.HasEmptySlot());
     pos.Remove("item1");
     Assert.AreEqual(true, pos.HasEmptySlot());
     pos.Add("item2", 200, 100);
     Assert.AreEqual(true, pos.HasEmptySlot());
     pos.Add("item3", 200, 100);
     Assert.AreEqual(true, pos.HasEmptySlot());
     pos.Add("item4", 200, 100);
     Assert.AreEqual(false, pos.HasEmptySlot());
 }
        public void PositionerTest3() {
            var pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(10, 25, 790, 575), NotificationPosition.TopRight, 100);
            Point p = pos.Add("item1", 200, 100);
            Assert.AreEqual(10 + 790 - 200, p.X);
            Assert.AreEqual(25 + 20, p.Y);

            pos = new NotificationPositioner<string>();
            pos.Update(new System.Drawing.Rectangle(10, 25, 790, 575), NotificationPosition.BottomRight, 100);
            p = pos.Add("item1", 200, 100);
            Assert.AreEqual(10 + 790 - 200, p.X);
            Assert.AreEqual(600 - 20 - 100, p.Y);
        }
        public void PositionerTest()
        {
            var pos = new NotificationPositioner <string>();

            pos.Update(new Rect(0, 0, 800, 600), NotificationPosition.TopRight, 3);
            Point p;

            Assert.AreEqual(true, pos.HasEmptySlot());

            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20, p.Y);

            p = pos.Add("item2", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10, p.Y);

            p = pos.Add("item3", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10 + 50 + 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());

            pos.Remove("item2");
            p = pos.Add("item4", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10, p.Y);

            pos.Remove("item3");
            p = pos.Add("item5", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(20 + 50 + 10 + 50 + 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());
            pos.Remove("item1");
            Assert.AreEqual(true, pos.HasEmptySlot());

            pos = new NotificationPositioner <string>();
            pos.Update(new Rect(0, 0, 800, 600), NotificationPosition.BottomRight, 3);
            p = pos.Add("item1", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20, p.Y);

            p = pos.Add("item2", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10, p.Y);

            p = pos.Add("item3", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10 - 50 - 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());

            pos.Remove("item2");
            p = pos.Add("item4", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10, p.Y);

            pos.Remove("item3");
            p = pos.Add("item5", 200, 50);
            Assert.AreEqual(800 - 200, p.X);
            Assert.AreEqual(600 - 50 - 20 - 50 - 10 - 50 - 10, p.Y);

            Assert.AreEqual(false, pos.HasEmptySlot());
            pos.Remove("item1");
            Assert.AreEqual(true, pos.HasEmptySlot());
        }
Esempio n. 10
0
        public void PositionerTest4() {
            var pos = new NotificationPositioner<string>();
            pos.Update(new Rect(0, 50, 800, 650), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 480);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new Rect(0, 50, 800, 650), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 460);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new Rect(0, 50, 800, 300), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 100);
            pos.Add("item1", 200, 100);
            Assert.AreEqual(false, pos.HasEmptySlot());

            pos = new NotificationPositioner<string>();
            pos.Update(new Rect(0, 50, 800, 410), NotificationPosition.TopRight, 100);
            pos.Add("item1", 200, 100);
            pos.Add("item1", 200, 100);
            Assert.AreEqual(true, pos.HasEmptySlot());
        }