コード例 #1
0
        /// <summary>
        /// Check whether two monitors are adjacent and not overlapped
        /// </summary>
        /// <param name="monitor1">Monitor 1</param>
        /// <param name="monitor2">Monitor 2</param>
        /// <returns></returns>
        private bool isAdjacent(DISPLAYCONTROL_MONITOR_LAYOUT monitor1, DISPLAYCONTROL_MONITOR_LAYOUT monitor2)
        {
            bool adjacent = false;

            // Monitor2 is adjacent to left of monitor1
            if (monitor2.Left + monitor2.Width == monitor1.Left &&
                monitor2.Top + monitor2.Height >= monitor1.Top &&
                monitor2.Top <= monitor1.Top + monitor1.Height)
            {
                adjacent = true;
            }
            // Monitor2 is adjacent to top of monitor1
            if (monitor2.Top + monitor2.Height == monitor1.Top &&
                monitor2.Left + monitor2.Width >= monitor1.Left &&
                monitor2.Left <= monitor1.Left + monitor1.Width)
            {
                adjacent = true;
            }
            // Monitor2 is adjacent to right of monitor1
            if (monitor2.Left == monitor1.Left + monitor1.Width &&
                monitor2.Top + monitor1.Height >= monitor1.Top &&
                monitor2.Top <= monitor1.Top + monitor1.Height)
            {
                adjacent = true;
            }
            // Monitor2 is adjacent to bottom of monitor1
            if (monitor2.Top == monitor1.Top + monitor1.Height &&
                monitor2.Left + monitor2.Width >= monitor1.Left &&
                monitor2.Left <= monitor1.Left + monitor1.Width)
            {
                adjacent = true;
            }
            return(adjacent);
        }
コード例 #2
0
        /// <summary>
        /// Check whether two monitors are overlapped
        /// </summary>
        /// <param name="monitor1">Monitor 1</param>
        /// <param name="Monitor2">Monitor 2</param>
        /// <returns></returns>
        private bool isOverlap(DISPLAYCONTROL_MONITOR_LAYOUT monitor1, DISPLAYCONTROL_MONITOR_LAYOUT Monitor2)
        {
            bool overlap = true;

            // Monitor2 in left of Monitor1
            if (Monitor2.Left + Monitor2.Width <= monitor1.Left)
            {
                overlap = false;
            }
            // Monitor2 is above of Monitor1
            if (Monitor2.Top + Monitor2.Height <= monitor1.Top)
            {
                overlap = false;
            }
            // Monitor2 in right of Monitor1
            if (Monitor2.Left >= monitor1.Left + monitor1.Width)
            {
                overlap = false;
            }
            // Monitor2 is beneath of Monitor1
            if (Monitor2.Top >= monitor1.Top + monitor1.Height)
            {
                overlap = false;
            }
            return(overlap);
        }
コード例 #3
0
        /// <summary>
        /// Common test body
        /// </summary>
        private void ChangeDesktopOrientation(string caseName, MonitorLayout_OrientationValues orientation, bool enhancedAdapter = false)
        {
            if (!enhancedAdapter)
            {
                int result = this.rdpedispSutControlAdapter.TriggerOrientationChangeOnClient(caseName, OrientationToDEVMODEValue(orientation));
                if (result >= 0)
                {
                    // Wait for screen orientation change
                    System.Threading.Thread.Sleep(1000);
                    result = this.rdpedispSutControlAdapter.TriggerMaximizeRDPClientWindow(caseName);
                    // Wait for maximize RDP client Window
                    System.Threading.Thread.Sleep(4000);
                }
                this.TestSite.Assert.IsTrue(result >= 0, "Test case fails due to fail operation.");
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect Display Monitor Layout PDU to change orientation");
            DISPLAYCONTROL_MONITOR_LAYOUT_PDU monitorLayoutPDU = this.rdpedispAdapter.expectMonitorLayoutPDU();

            this.Site.Assert.AreEqual <uint>(40, monitorLayoutPDU.MonitorLayoutSize, "This field MUST be set to 40 bytes, the size of the DISPLAYCONTROL_MONITOR_LAYOUT structure (MS-RDPEDISP section 2.2.2.2.1).");
            this.Site.Assert.AreEqual <uint>(1, monitorLayoutPDU.NumMonitors, "Only one Monitor for this case");
            DISPLAYCONTROL_MONITOR_LAYOUT monitor = monitorLayoutPDU.Monitors[0];

            this.Site.Assert.AreEqual <MonitorLayout_FlagValues>(MonitorLayout_FlagValues.DISPLAYCONTROL_MONITOR_PRIMARY, monitor.Flags, "Client should set this monitor to primary monitor");
            this.Site.Assert.AreEqual <int>(0, monitor.Left, "The left point of the only one monitor should be 0");
            this.Site.Assert.AreEqual <int>(0, monitor.Top, "The Top point of the only one monitor should be 0");
            if (orientation == MonitorLayout_OrientationValues.ORIENTATION_PORTRAIT || orientation == MonitorLayout_OrientationValues.ORIENTATION_PORTRAIT_FLIPPED)
            {
                this.Site.Assert.AreEqual <uint>(originalDesktopHeight, monitor.Width, "The width of monitor MUST be {0}", originalDesktopHeight);
                this.Site.Assert.AreEqual <uint>(originalDesktopWidth, monitor.Height, "The height of monitor MUST be {0}", originalDesktopWidth);
            }
            else
            {
                this.Site.Assert.AreEqual <uint>(originalDesktopWidth, monitor.Width, "The width of monitor MUST be {0}", originalDesktopWidth);
                this.Site.Assert.AreEqual <uint>(originalDesktopHeight, monitor.Height, "The height of monitor MUST be {0}", originalDesktopHeight);
            }
            this.Site.Assert.AreEqual <MonitorLayout_OrientationValues>(orientation, monitor.Orientation, "The Orientation of monitor MUST be {0}", orientation);

            // Clear receive buffer
            this.rdpedispAdapter.ClearReceivedList();
        }
コード例 #4
0
        /// <summary>
        /// Common test body
        /// </summary>
        private void ChangeDesktopResolution()
        {
            int result = this.rdpedispSutControlAdapter.TriggerResolutionChangeOnClient(changedDesktopWidth, changedDekstopHeight);

            System.Threading.Thread.Sleep(SUTAdapterWaitTime);
            this.TestSite.Assert.IsTrue(result >= 0, "Test case fails due to fail operation.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect Display Monitor Layout PDU to change resolution");
            DISPLAYCONTROL_MONITOR_LAYOUT_PDU monitorLayoutPDU = this.rdpedispAdapter.expectMonitorLayoutPDU();

            this.Site.Assert.AreEqual <uint>(40, monitorLayoutPDU.MonitorLayoutSize, "This field MUST be set to 40 bytes, the size of the DISPLAYCONTROL_MONITOR_LAYOUT structure (MS-RDPEDISP section 2.2.2.2.1).");
            this.Site.Assert.AreEqual <uint>(1, monitorLayoutPDU.NumMonitors, "Only one Monitor for this case");
            DISPLAYCONTROL_MONITOR_LAYOUT monitor = monitorLayoutPDU.Monitors[0];

            this.Site.Assert.AreEqual <MonitorLayout_FlagValues>(MonitorLayout_FlagValues.DISPLAYCONTROL_MONITOR_PRIMARY, monitor.Flags, "Client should set this monitor to primary monitor");
            this.Site.Assert.AreEqual <int>(0, monitor.Left, "The left point of the only one monitor should be 0");
            this.Site.Assert.AreEqual <int>(0, monitor.Top, "The Top point of the only one monitor should be 0");
            this.Site.Assert.AreEqual <uint>(changedDesktopWidth, monitor.Width, "The width of monitor MUST be {0}", changedDesktopWidth);
            this.Site.Assert.AreEqual <uint>(changedDekstopHeight, monitor.Height, "The height of monitor MUST be {0}", changedDekstopHeight);
            this.Site.Assert.AreEqual <MonitorLayout_OrientationValues>(MonitorLayout_OrientationValues.ORIENTATION_LANDSCAPE, monitor.Orientation, "The height of monitor MUST be LANDSCAPE");
        }
コード例 #5
0
        /// <summary>
        /// Common test body Monitor Removal
        /// </summary>
        private void MonitorRemoval(string caseName)
        {
            // interactive adapter
            // ToDo: automatic method
            int result = this.rdpedispSutControlAdapter.TriggerMonitorAdditionRemovalOnClient(caseName, "Remove a monitor");

            this.TestSite.Assert.IsTrue(result >= 0, "Test case fails due to fail operation.");

            // Remove a monitor
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect Display Monitor Layout PDU to add monitors");
            DISPLAYCONTROL_MONITOR_LAYOUT_PDU monitorLayoutPDU = this.rdpedispAdapter.expectMonitorLayoutPDU();

            this.Site.Assert.AreEqual <uint>(40, monitorLayoutPDU.MonitorLayoutSize, "This field MUST be set to 40 bytes, the size of the DISPLAYCONTROL_MONITOR_LAYOUT structure (MS-RDPEDISP section 2.2.2.2.1).");
            this.Site.Assert.AreEqual <uint>(1, monitorLayoutPDU.NumMonitors, "another monitor should be removed");
            DISPLAYCONTROL_MONITOR_LAYOUT primaryMonitor = monitorLayoutPDU.Monitors[0];

            this.Site.Assert.AreEqual <MonitorLayout_FlagValues>(MonitorLayout_FlagValues.DISPLAYCONTROL_MONITOR_PRIMARY, primaryMonitor.Flags, "Client should set this monitor to primary monitor");
            this.Site.Assert.AreEqual <int>(0, primaryMonitor.Left, "The left point of the only one monitor should be 0");
            this.Site.Assert.AreEqual <int>(0, primaryMonitor.Top, "The Top point of the only one monitor should be 0");
            this.TestSite.Assert.IsTrue(primaryMonitor.Width >= 200 && primaryMonitor.Width <= 8192, "The width MUST be greater than or equal to 200 pixels and less than or equal to 8192 pixels (MS-RDPEDISP section 2.2.2.2.1)");
            this.TestSite.Assert.IsTrue(primaryMonitor.Width % 2 == 0, "The width MUST NOT be an odd value");
            this.TestSite.Assert.IsTrue(primaryMonitor.Height >= 200 && primaryMonitor.Height <= 8192, "The height MUST be greater than or equal to 200 pixels and less than or equal to 8192 pixels (MS-RDPEDISP section 2.2.2.2.1)");
        }