Subject: | Install Fails: Ymax is 9001 |
Hi there. Installing Win32::Console::ANSI is failing for me (on Windows 10). The failing tests all involve $Ymax. On this system $Ymax is being set to 9001, but there are tests which seem to presume that 1000 will be bigger than $Ymax.
For instance, in t/02_CursorFunc.pl:
# test 22
Cursor(17, 5);
Cursor(17, 1000);
($x, $y) = Cursor();
ok( $x==17 and $y==$Ymax );
I get $y == 1000, so $y == $Ymax fails.
The test can be made to pass by ensuring the requested Y-co-ordinate is bigger than $Ymax:
Cursor(17, $Ymax + 100);
The attached patch attempts to do this.
However, it only cures _some_ of the failing tests. I suspect that to understand why, I'd have to learn what the various tests and escape codes are trying to do.
Test affected:
• 02_CursorFunc.pl: 22, 23
• 03_CursorMove.pl: 69, 74, 76*, 81, 86, 88*
The two tests marked with an asterisk are the ones that still fail even with the attached patch.
Subject: | dynamic_Y_max.diff |
diff -ur Win32-Console-ANSI-1.10/t/02_CursorFunc.pl Win32-Console-ANSI-1.10_patched/t/02_CursorFunc.pl
--- Win32-Console-ANSI-1.10/t/02_CursorFunc.pl 2015-06-16 17:37:19.000000000 +0100
+++ Win32-Console-ANSI-1.10_patched/t/02_CursorFunc.pl 2016-11-01 13:03:39.275471164 +0000
@@ -141,13 +141,13 @@
# test 22
Cursor(17, 5);
-Cursor(17, 1000);
+Cursor(17, $Ymax + 100);
($x, $y) = Cursor();
ok( $x==17 and $y==$Ymax );
# test 23 # all max
Cursor(17, 5);
-Cursor(1200 , 1000);
+Cursor($Xmax + 100, $Ymax + 100);
($x, $y) = Cursor();
ok( $x==$Xmax and $y==$Ymax );
diff -ur Win32-Console-ANSI-1.10/t/03_CursorMove.pl Win32-Console-ANSI-1.10_patched/t/03_CursorMove.pl
--- Win32-Console-ANSI-1.10/t/03_CursorMove.pl 2015-06-16 17:57:15.000000000 +0100
+++ Win32-Console-ANSI-1.10_patched/t/03_CursorMove.pl 2016-11-01 13:01:56.844093926 +0000
@@ -26,6 +26,8 @@
# ****************************** BEGIN TESTS
my ($Xmax, $Ymax) = XYMax();
+my $TooTall = $Ymax + 100;
+my $TooWide = $Xmax + 100;
# test 01
print "\e[2J"; # clear screen
@@ -453,7 +455,7 @@
# test 69
Cursor(12, 4);
-print "\e[1000H";
+print "\e[${TooTall}H";
($x, $y) = Cursor();
ok( $x==1 and $y==$Ymax );
@@ -483,7 +485,7 @@
# test 74
Cursor(12, 4);
-print "\e[1000;9H";
+print "\e[$TooTall;9H";
($x, $y) = Cursor();
ok( $x==9 and $y==$Ymax );
@@ -495,7 +497,7 @@
# test 76
Cursor(12, 4);
-print "\e[1000;2000H";
+print "\e[1000;${TooTall}H";
($x, $y) = Cursor();
ok( $x==$Xmax and $y==$Ymax );
@@ -527,7 +529,7 @@
# test 81
Cursor(12, 4);
-print "\e[1000f";
+print "\e[${TooTall}f";
($x, $y) = Cursor();
ok( $x==1 and $y==$Ymax );
@@ -557,7 +559,7 @@
# test 86
Cursor(12, 4);
-print "\e[1000;9f";
+print "\e[$TooTall;9f";
($x, $y) = Cursor();
ok( $x==9 and $y==$Ymax );
@@ -569,7 +571,7 @@
# test 88
Cursor(12, 4);
-print "\e[1000;2000f";
+print "\e[$TooWide;${TooTall}f";
($x, $y) = Cursor();
ok( $x==$Xmax and $y==$Ymax );