예제 #1
0
        private static string GetCurrent()
        {
            if (WindowsVersion.IsWindows7())
            {
                return("Win7");
            }

            if (WindowsVersion.IsWindows10())
            {
                return("Win10");
            }

            if (WindowsVersion.CurrentContains("Windows Server 2019"))
            {
                return("WinServer2019");
            }

            return(WindowsVersion.CurrentVersionProductName);
        }
예제 #2
0
        public void RenderBounds()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, "SizeWindow");
            var window = app.MainWindow;
            var button = window.FindButton("SizeButton");

            window.MoveTo(100, 200);
            if (WindowsVersion.IsWindows7())
            {
                Assert.AreEqual(new System.Windows.Rect(150, 311, 200, 100), button.Bounds);
                Assert.AreEqual(new System.Windows.Rect(100, 200, 300, 300), window.Bounds);
                Assert.AreEqual(new System.Windows.Rect(50, 111, 200, 100), button.RenderBounds);
            }
            else
            {
                Assert.AreEqual(new System.Windows.Rect(150, 311, 200, 100), button.Bounds);
                Assert.AreEqual(new System.Windows.Rect(100, 200, 300, 300), window.Bounds);
                Assert.AreEqual(new System.Windows.Rect(50, 111, 200, 100), button.RenderBounds);
            }
        }
예제 #3
0
        public void CalculatorTest()
        {
            using (var app = StartApplication())
            {
                var window = app.MainWindow;
                var calc   = WindowsVersion.IsWindows10()
                    ? (ICalculator) new Win10Calc(window)
                    : new LegacyCalc(window);
                if (WindowsVersion.IsWindows7())
                {
                    Wait.For(TimeSpan.FromMilliseconds(200));
                }

                // Switch to default mode
                Keyboard.TypeSimultaneously(Key.ALT, Key.KEY_1);
                window.WaitUntilResponsive();

                // Simple addition
                calc.Button1.Click();
                calc.Button2.Click();
                calc.Button3.Click();
                calc.Button4.Click();
                calc.ButtonAdd.Click();
                calc.Button5.Click();
                calc.Button6.Click();
                calc.Button7.Click();
                calc.Button8.Click();
                calc.ButtonEquals.Click();
                app.WaitWhileBusy();
                var result = calc.Result;
                Assert.AreEqual("6912", result);

                // Date comparison
                using (Keyboard.Pressing(Key.CONTROL))
                {
                    Keyboard.Type(Key.KEY_E);
                }
            }
        }