示例#1
0
        public void TestOneMonitorWindowTooBig()
        {
            var window = new Desktop.Window(new Desktop.Point(10, 169), new Size(1024, 768));

            var screen       = new Desktop.Screen(new Desktop.Point(0, 0), new Size(800, 600));
            var desktop      = new Desktop(new[] { screen });
            var actualWindow = desktop.ClipToBoundaries(window);

            actualWindow.Should().NotBeSameAs(window);
            actualWindow.Left.Should().Be(0, "because the window should've been moved to the center");
            actualWindow.Top.Should().Be(0, "because the window should've been moved to the center");
            actualWindow.Width.Should().Be(800);
            actualWindow.Height.Should().Be(600);
        }
示例#2
0
        public void TestOneMonitorWindowFits()
        {
            var window = new Desktop.Window(new Desktop.Point(10, 20), new Size(800, 600));

            var screen       = new Desktop.Screen(new Desktop.Point(0, 0), new Size(1024, 768));
            var desktop      = new Desktop(new[] { screen });
            var actualWindow = desktop.ClipToBoundaries(window);

            actualWindow.Should().BeSameAs(window);
            actualWindow.Left.Should().Be(10);
            actualWindow.Top.Should().Be(20);
            actualWindow.Width.Should().Be(800);
            actualWindow.Height.Should().Be(600);
        }