Exemple #1
0
        public void CalcBoundsOnQuadrantIII()
        {
            ScreenFacade negMon = new ScreenFacade(new Rectangle(-100, 0, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, 20, screens);

            Assert.AreEqual(90, xy.X);
            Assert.AreEqual(20, xy.Y);
        }
Exemple #2
0
        public void CalcBoundsOnQuadrantI()
        {
            ScreenFacade negMon  = new ScreenFacade(new Rectangle(0, -200, 100, 200));
            ScreenFacade primary = new ScreenFacade(new Rectangle(0, 0, 150, 250));

            IScreen[] screens = new IScreen[] { negMon, primary };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(10, -20, screens);

            Assert.AreEqual(10, xy.X);
            Assert.AreEqual(180, xy.Y);
        }
Exemple #3
0
        public void PerfMaping()
        {
            var negMon = new ScreenFacade(new Rectangle(-50, -50, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       sw      = Stopwatch.StartNew();
            const int Runs    = 1000 * 1000;

            for (int i = 0; i < Runs; i++)
            {
                var xy = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, -20, screens);
            }
            sw.Stop();
            Console.WriteLine($"Calls/s {Runs / sw.Elapsed.TotalSeconds:N0}");
        }
Exemple #4
0
        public void CalcOverlappingQuadrants()
        {
            ScreenFacade negMon = new ScreenFacade(new Rectangle(-50, -50, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, -20, screens);

            Assert.AreEqual(40, xy.X);
            Assert.AreEqual(30, xy.Y);

            var xy00 = ScreenCoordinateMapper.ScreenToDesktopCoordinates(0, 0, screens);

            Assert.AreEqual(50, xy00.X);
            Assert.AreEqual(50, xy00.Y);

            var xy50_150 = ScreenCoordinateMapper.ScreenToDesktopCoordinates(49, 149, screens);

            Assert.AreEqual(99, xy50_150.X);
            Assert.AreEqual(199, xy50_150.Y);
        }