Log in Page Discussion History Go to the site toolbox

GuiTestAndCygwinPatch

From BluWiki

From:  "jonathanalbrecht" <ohboyspam@...>

   jonathan dot albrecht at sitraka dot com
   albrecht * algorithmics.com  

Date:  Wed Jul 31, 2002 4:40 pm
Subject: Patch for Win32-GuiTest-1.3 and cygwin

Message #121 of 1780 

Here is a patch to get version 1.3 to work out of the box with
cygwin perl. All of the tests in test.pl pass but that is the
extent of my testing. I have not looked at any of the example
scripts yet.

The changes should not break ActiveState perl, but I have no way
of testing it.

I'm posting from the web page so the patch might get a bit mangled.

Jonathan Albrecht

diff -ruN Win32-GuiTest-1.3.orig/GuiTest.xs Win32-GuiTest-1.3/GuiTest.xs
--- Win32-GuiTest-1.3.orig/GuiTest.xs 2001-12-02 00:08:08.000000000 -0500
+++ Win32-GuiTest-1.3/GuiTest.xs 2002-07-31 12:15:52.000000000 -0400
@@ -144,7 +144,7 @@
}
tmp[pos] = '\0';
res = atoi(tmp);
- free(tmp);
+ safefree(tmp);
return res;
}

@@ -219,7 +219,7 @@
OutputDebugString("Found PAUSE\n");

Sleep(*count);

*key=0;
-
free(tmp);
+
safefree(tmp);

return;

}


@@ -229,7 +229,7 @@

/* if key=0 here then something is bad */
} /* end of token processing */

-
free(tmp);
+
safefree(tmp);
}

/* Wrapper around kebyd_event */
diff -ruN Win32-GuiTest-1.3.orig/test.pl Win32-GuiTest-1.3/test.pl
--- Win32-GuiTest-1.3.orig/test.pl 2001-12-01 23:34:50.000000000 -0500
+++ Win32-GuiTest-1.3/test.pl 2002-07-31 12:15:59.000000000 -0400
@@ -60,8 +60,13 @@
print "ok 4\n";

# Create a notepad window and check we can find it
-system("start notepad.exe guitest.pm");
-sleep 1;
+if ($pid = fork) {
+ sleep 1
+;
+} else {
+ die "cannot fork: $!" unless defined $pid;
+
exec("notepad.exe", "GuiTest.pm");
+}
my @windows = FindWindowLike(0, "Gui[tT]est", "Notepad");
print "not " unless scalar @windows == 1;
print "ok 5\n";
@@ -75,7 +80,7 @@
# Get the contents (should be the GuiTest.pm file)
$content = WMGetText($edits[0]);
SendKeys("%{F4}");
-open(GUI_FILE, "<guitest.pm");
+open(GUI_FILE, "<GuiTest.pm");
@lines = <GUI_FILE>;
close GUI_FILE;
$file_content = join('', @lines);
@@ -85,8 +90,13 @@
print "ok 8\n";

# Open a notepad and type some text into it
-system("start notepad.exe");
-sleep 1;
+if ($pid = fork) {
+ sleep 1
+;
+} else {
+ die "cannot fork: $!" unless defined $pid;
+
exec("notepad.exe");
+}
@windows = FindWindowLike(0, "", "Notepad");
print "not " unless scalar @windows == 1;
print "ok 9\n";
@@ -160,8 +170,13 @@
print "ok 17\n";

# Do some tricks with the calculator
-system("start calc");
-sleep 1;
+if ($pid = fork) {
+ sleep 1
+;
+} else {
+ die "cannot fork: $!" unless defined $pid;
+
exec("calc.exe");
+}
my ($calc) = FindWindowLike($desk, undef, "^SciCalc\$");
print "not " unless IsWindow($calc);
SetForegroundWindow($calc);




Site Toolbox:

Personal tools
GNU Free Documentation License 1.2
This page was last modified on 30 April 2007, at 18:47.
Disclaimers - About BluWiki