Subject: | Pre-existing Notepad, Calc windows will cause test failure |
Summary: Various tests assume that the windows they open are the only
windows of that class currently open. If any Notepad or Calc windows are
already open when testing begins, testing will fail.
Symptoms: multiple test failures
To reproduce: In Win32-GuiTest-1.56, run:
perl Makefile.PL
dmake
dmake test
or, more specifically:
prove -b -v t\01_basic.t t\02_calc.t
Workaround:
Close all Notepad and Calc windows before testing.
Fix:
At the beginning of t\01_basic.t t\02_calc.t, check for existing Notepad
and Calc windows and bail out if any are found. An example patch is
attached.
Subject: | existing_windows.patch |
diff -u t_orig/01_basic.t t/01_basic.t
--- t_orig/01_basic.t 2008-10-01 07:10:12.000000000 -0400
+++ t/01_basic.t 2009-10-25 13:18:56.718750000 -0400
@@ -32,6 +32,13 @@
my @desks = grep { $_ == $root } @wins;
ok(! @desks, "The desktop is not on the window list");
+# Make sure there are no existing Notepad windows to interfere with testing
+{
+ my @notepad_windows = FindWindowLike(0, "", "Notepad");
+ BAIL_OUT('Please close existing Notepad windows before proceeding')
+ if @notepad_windows;
+}
+
# Create a notepad window and check we can find it
system("cmd /c start notepad.exe README");
my @waitwin = WaitWindowLike(0, "readme|README", "Notepad");
diff -u t_orig/02_calc.t t/02_calc.t
--- t_orig/02_calc.t 2009-10-25 13:26:57.718750000 -0400
+++ t/02_calc.t 2009-10-25 13:28:07.890625000 -0400
@@ -14,6 +14,14 @@
my $desk = GetDesktopWindow();
+# Make sure there are no existing Calc windows to interfere with testing
+{
+ my @calc_windows = FindWindowLike(0, "", "Calc");
+ BAIL_OUT('Please close existing Calculator windows before proceeding')
+ if @calc_windows;
+}
+
+
# It seems that if the calculator opens as Standard then even if we
# select Scientific mode we cannot find the Hex button.
# If the calculater already opens as Scientific then things work OK.