Sha256: 70f2c6c71d67913a4cf5167c4dccb1ed888aeaf3f1d1382d9ca7e76513c74760

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

ASCII_MODIFIED_QR = <<EOF
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.
.#######.##.....##.#.##....#######.
.#.....#.......##.#.##.....#.....#.
.#.###.#.#..#####..#.#..##.#.###.#.
.#.###.#.##.#....#.####.##.#.###.#.
.#.###.#.####.#....#.####..#.###.#.
.#.....#..#..#.#..#####....#.....#.
.#######.#.#.#.#.#.#.#.#.#.#######.
..........#.#.##.....##.##.........
.####..#.#....##.#.##....##..###.#.
..#.##...##.....##.#.##.#.###...##.
.#.###.##......##.#.##..##.#.###.#.
....###.#...#####..#.#...##.#...#..
.##.##.#..#.#....#.####..##.##.....
...#..#.##.##.#....#.###.##....##..
.#.######.##.#.#..#####..#######...
.#.####..###.##.#.##....#...##.#...
...##.##..###.....##.#.##.########.
.....#..###..##.....##.#########.#.
.####.#####.##.....##.#...#...#.#..
..##.#..#..#.#..#####..#.#..##...#.
...######.#####.#....#.##......#...
..###.....#..####.#....###.#...###.
.###..####.####..#.#..#######...##.
.#.#.##.##.#.....##.#.##.######.#..
..#.#######..#.##.....##.#####...#.
.........#.###.#.##.....##...#.#...
.#######....#.#.##.....###.#.#.....
.#.....#..###..#.#..######...###.#.
.#.###.#.....#.####.#...########...
.#.###.#.###...#.####.#.#.#........
.#.###.#.###..#####..#.##..#..#....
.#.....#.####.##.....##.###......#.
.#######.#.#..##.#.##...#.##...#...
...................................
EOF

describe "ZPNG modify" do
  it "should have QR examples" do
    SAMPLES.should_not be_empty
  end
  SAMPLES.each do |fname|
    describe fname.sub(File.dirname(SAMPLES_DIR)+'/','') do
      img = ZPNG::Image.new(fname)
      it "modifies img - color=#{img.hdr.color}, depth=#{img.hdr.depth}, bpp=#{img.hdr.bpp}" do
        img.width.times do |x|
          img[x,0] = (x%2==0) ? ZPNG::Color::WHITE : ZPNG::Color::BLACK
        end
        img.to_ascii('#.').strip.should == ASCII_MODIFIED_QR.strip
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zpng-0.2.1 spec/modify_spec.rb
zpng-0.2.0 spec/modify_spec.rb