Sha256: b641ca31d7ef1ea9ce9ed4129a0421f05357b6f3ef56db4683ee59ca9dc17995

Contents?: true

Size: 1.84 KB

Versions: 15

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.load(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

15 entries across 15 versions & 1 rubygems

Version Path
zpng-0.4.5 spec/modify_spec.rb
zpng-0.4.4 spec/modify_spec.rb
zpng-0.4.3 spec/modify_spec.rb
zpng-0.4.2 spec/modify_spec.rb
zpng-0.4.1 spec/modify_spec.rb
zpng-0.4.0 spec/modify_spec.rb
zpng-0.3.4 spec/modify_spec.rb
zpng-0.3.3 spec/modify_spec.rb
zpng-0.3.2 spec/modify_spec.rb
zpng-0.3.1 spec/modify_spec.rb
zpng-0.3.0 spec/modify_spec.rb
zpng-0.2.5 spec/modify_spec.rb
zpng-0.2.4 spec/modify_spec.rb
zpng-0.2.3 spec/modify_spec.rb
zpng-0.2.2 spec/modify_spec.rb