public void Collect() { var w = new vScreen.lib.Window(WindowUnitTests.StartTestApp()); var s = new vScreen.lib.Screen(0); Assert.IsTrue(s.Count > 0); Assert.IsTrue(s.GetWindowByTitle(WindowUnitTests.TestAppTitle).Count == 1); WindowUnitTests.KillTestApp(); }
public void WindowBasicFeature() { var w = new vScreen.lib.Window(StartTestApp()); Assert.AreEqual(TestAppTitle, w.Title); Assert.AreEqual("WindowsForms10.Window.8.app.0.2bf8098_r18_ad1", w.ClassName); Assert.IsTrue(w.ClassName.Contains("WindowsForms10")); Assert.IsTrue(w.ClassName.Contains(".Window.")); AssertDefaultSizeAndPositionOfTestAppMainWindow(w); KillTestApp(); }
private void tmrBkTask_Tick(object sender, EventArgs e) { var h = vScreen.lib.WinApi.GetForegroundWindow(); if (h == this.Handle) { // We should not zero the value, else we only have 2 second to make the switch // Now we always store/display the last active app which is not vScreen.net // this._currentWindowHandle = IntPtr.Zero; } else { this._currentWindowHandle = h; } this._tmrBackground2SecondCounter++; if (_showAllScreenForm) { this.Focus(); this.Activate(); Application.DoEvents(); _showAllScreenForm = false; showAllScreensToolStripMenuItem_Click(null, null); } if (this._tmrBackground2SecondCounter >= 1) { this._tmrBackground2SecondCounter = 0; if (this._currentWindowHandle == IntPtr.Zero) { this.lblCurrentApp.Tag = null; this.lblCurrentApp.Text = null; } else { var w = new vScreen.lib.Window(this._currentWindowHandle); if (!vScreen.lib.Screen.WindowShouldBeIgnored(w.Title, w.ClassName)) { this.lblCurrentApp.Tag = w; this.lblCurrentApp.Text = w.Title; } } } }
public void DoNotCollectNotVisibleWindow() { var w = new vScreen.lib.Window(WindowUnitTests.StartTestApp()); var s1 = new vScreen.lib.Screen(0); Assert.IsTrue(s1.GetWindowByTitle(WindowUnitTests.TestAppTitle).Count == 1); w.Hide(); var s2 = new vScreen.lib.Screen(0); Assert.IsTrue(s2.GetWindowByTitle(WindowUnitTests.TestAppTitle).Count == 0); w.Show(); var s3 = new vScreen.lib.Screen(0); Assert.IsTrue(s3.GetWindowByTitle(WindowUnitTests.TestAppTitle).Count == 1); WindowUnitTests.KillTestApp(); }
public void MoveWindow() { var w = new vScreen.lib.Window(StartTestApp()); AssertDefaultSizeAndPositionOfTestAppMainWindow(w); w.Left += 100; w.Top += 100; w.Width += 100; w.Height += 100; var newSize = 600; Assert.AreEqual(newSize, w.Left); Assert.AreEqual(newSize, w.Top); Assert.AreEqual(newSize, w.Width); Assert.AreEqual(newSize, w.Height); KillTestApp(); }