Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit159bd27

Browse files
committed
ProgressBar clears too many lines on update (test only, should fail)
1 parentbbf786c commit159bd27

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,32 @@ public function testOverwriteWithSectionOutput()
343343
);
344344
}
345345

346+
// ensure that ANSI characters are excluded when calculating line length
347+
publicfunctiontestOverwriteWithAnsiSectionOutput()
348+
{
349+
// output has 43 visible characters plus 2 invisible ANSI characters
350+
putenv('COLUMNS=43');
351+
$sections = [];
352+
$stream =$this->getOutputStream(true);
353+
$output =newConsoleSectionOutput($stream->getStream(),$sections,$stream->getVerbosity(),$stream->isDecorated(),newOutputFormatter());
354+
355+
$bar =newProgressBar($output,50,0);
356+
$bar->setFormat("\033[44;37m%current%/%max%\033[0m [%bar%] %percent:3s%%");
357+
$bar->start();
358+
$bar->display();
359+
$bar->advance();
360+
$bar->advance();
361+
362+
rewind($output->getStream());
363+
$this->assertEquals(
364+
"\033[44;37m 0/50\033[0m [>---------------------------] 0%".\PHP_EOL.
365+
"\x1b[1A\x1b[0J"."\033[44;37m 1/50\033[0m [>---------------------------] 2%".\PHP_EOL.
366+
"\x1b[1A\x1b[0J"."\033[44;37m 2/50\033[0m [=>--------------------------] 4%".\PHP_EOL,
367+
stream_get_contents($output->getStream())
368+
);
369+
putenv('COLUMNS=120');
370+
}
371+
346372
publicfunctiontestOverwriteMultipleProgressBarsWithSectionOutputs()
347373
{
348374
$sections = [];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp