Merge pull request #15 from ivanceras/master

Use unicode block for rendering of QR string
This commit is contained in:
kennytm 2017-07-18 16:23:25 +08:00 committed by GitHub
commit 000e218b62

View file

@ -11,7 +11,7 @@ pub trait Element: Copy {
impl Element for char { impl Element for char {
fn default_color(color: Color) -> Self { fn default_color(color: Color) -> Self {
color.select('#', ' ') color.select('', ' ')
} }
fn strlen(self) -> usize { fn strlen(self) -> usize {
@ -25,7 +25,7 @@ impl Element for char {
impl<'a> Element for &'a str { impl<'a> Element for &'a str {
fn default_color(color: Color) -> Self { fn default_color(color: Color) -> Self {
color.select("#", " ") color.select("", " ")
} }
fn strlen(self) -> usize { fn strlen(self) -> usize {
@ -106,7 +106,7 @@ fn test_render_to_string() {
Color::Light, Color::Dark, Color::Light, Color::Dark,
]; ];
let image: String = Renderer::<char>::new(colors, 2, 1).build(); let image: String = Renderer::<char>::new(colors, 2, 1).build();
assert_eq!(&image, " \n # \n # \n "); assert_eq!(&image, " \n \n \n ");
let image2 = Renderer::new(colors, 2, 1) let image2 = Renderer::new(colors, 2, 1)
.light_color("A") .light_color("A")