Bug Fix - #372 Color blending/mapping broken

- Corrected problem in unit test that expected the wrong result.
- Fixed Color::Color (const std::string&) so that the foreground and
  background are now considered two different colors, are upgraded
  separately, if necessary, and then blended.  The problem affected
  all instances of "<256-color> on <16-color>".  Hooray for unit
  tests.
This commit is contained in:
Paul Beckingham 2010-02-06 16:54:07 -05:00
parent 89ae64c5fb
commit 579ebe6130
3 changed files with 49 additions and 42 deletions

View file

@ -102,7 +102,7 @@ int main (int argc, char** argv)
t.is (Color::colorize ("foo", "white"), std::string ("\033[37mfoo\033[0m"), "white -> ^[[37m");
// 16-color backgrounds.
t.is (Color::colorize ("foo", "on bright black"), std::string ("\033[90mfoo\033[0m"), "on bright black -> ^[[90m");
t.is (Color::colorize ("foo", "on bright black"), std::string ("\033[100mfoo\033[0m"), "on bright black -> ^[[100m");
t.is (Color::colorize ("foo", "on black"), std::string ("\033[40mfoo\033[0m"), "on black -> ^[[40m");
t.is (Color::colorize ("foo", "on red"), std::string ("\033[41mfoo\033[0m"), "on red -> ^[[41m");