Skip Menu |

This queue is for tickets about the Win32-Console-ANSI CPAN distribution.

Report information
The Basics
Id: 118585
Status: open
Priority: 0/
Queue: Win32-Console-ANSI

People
Owner: Nobody in particular
Requestors: SMYLERS [...] cpan.fsck.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.10
Fixed in: (no value)



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 );
On Tue Nov 01 09:09:12 2016, SMYLERS wrote: Show quoted text
> 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. > ...
I'm including a patch based of my repository (https://github.com/rivy/perl.Win32-Console-ANSI) that fixes all the errors.
Subject: 0001-fix-failing-tests-for-larger-console-windows.patch
From 758809ad919d98241c82b6f62d7cdebd1c658a2b Mon Sep 17 00:00:00 2001 From: Roy Ivy III <rivy.dev@gmail.com> Date: Sun, 22 Oct 2017 14:37:54 -0500 Subject: [PATCH] fix: failing tests for larger console windows * note: based on the patch supplied by SMYLERS (see [RT#118585](https://rt.cpan.org/Public/Bug/Display.html?id=118585)) --- t/02_CursorFunc.pl | 5 +++-- t/03_CursorMove.pl | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/t/02_CursorFunc.pl b/t/02_CursorFunc.pl index 0d9d9e6..813b5d5 100644 --- a/t/02_CursorFunc.pl +++ b/t/02_CursorFunc.pl @@ -26,6 +26,7 @@ $npipe->Write("1..39\n"); # <== test plan # ====== BEGIN TESTS my ($Xmax, $Ymax) = XYMax(); +my ($Xoverflow, $Yoverflow) = ( ((1200 > $Xmax) ? 1200 : $Xmax+2), ((1000 > $Ymax) ? 1000 : $Ymax+2) ); # ======== tests Cursor function @@ -141,13 +142,13 @@ ok( $x==17 and $y==$Ymax ); # test 22 Cursor(17, 5); -Cursor(17, 1000); +Cursor(17, $Yoverflow); ($x, $y) = Cursor(); ok( $x==17 and $y==$Ymax ); # test 23 # all max Cursor(17, 5); -Cursor(1200 , 1000); +Cursor($Xoverflow, $Yoverflow); ($x, $y) = Cursor(); ok( $x==$Xmax and $y==$Ymax ); diff --git a/t/03_CursorMove.pl b/t/03_CursorMove.pl index 106925f..7486967 100644 --- a/t/03_CursorMove.pl +++ b/t/03_CursorMove.pl @@ -26,6 +26,7 @@ $npipe->Write("1..98\n"); # <== test plan # ****************************** BEGIN TESTS my ($Xmax, $Ymax) = XYMax(); +my ($Xoverflow, $Yoverflow) = ( ((1200 > $Xmax) ? 1200 : $Xmax+2), ((1000 > $Ymax) ? 1000 : $Ymax+2) ); # test 01 print "\e[2J"; # clear screen @@ -453,7 +454,7 @@ ok( $x==1 and $y==1 ); # test 69 Cursor(12, 4); -print "\e[1000H"; +print "\e[${Yoverflow}H"; ($x, $y) = Cursor(); ok( $x==1 and $y==$Ymax ); @@ -483,19 +484,19 @@ ok( $x==9 and $y==17 ); # test 74 Cursor(12, 4); -print "\e[1000;9H"; +print "\e[${Yoverflow};9H"; ($x, $y) = Cursor(); ok( $x==9 and $y==$Ymax ); # test 75 Cursor(12, 4); -print "\e[17;1000H"; +print "\e[17;${Xoverflow}H"; ($x, $y) = Cursor(); ok( $x==$Xmax and $y==17 ); # test 76 Cursor(12, 4); -print "\e[1000;2000H"; +print "\e[${Yoverflow};${Xoverflow}H"; ($x, $y) = Cursor(); ok( $x==$Xmax and $y==$Ymax ); @@ -527,7 +528,7 @@ ok( $x==1 and $y==1 ); # test 81 Cursor(12, 4); -print "\e[1000f"; +print "\e[${Yoverflow}f"; ($x, $y) = Cursor(); ok( $x==1 and $y==$Ymax ); @@ -557,19 +558,19 @@ ok( $x==9 and $y==17 ); # test 86 Cursor(12, 4); -print "\e[1000;9f"; +print "\e[${Yoverflow};9f"; ($x, $y) = Cursor(); ok( $x==9 and $y==$Ymax ); # test 87 Cursor(12, 4); -print "\e[17;1000f"; +print "\e[17;${Xoverflow}f"; ($x, $y) = Cursor(); ok( $x==$Xmax and $y==17 ); # test 88 Cursor(12, 4); -print "\e[1000;2000f"; +print "\e[${Yoverflow};${Xoverflow}f"; ($x, $y) = Cursor(); ok( $x==$Xmax and $y==$Ymax ); -- 2.14.1.windows.1