Sha256: 4370d7c706b9e3e82e5830da4b50d680281035fc3fdd06d8a45a7a151b6c5fd8

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe DXRubySDL::Image, '画像を表すクラス' do
  let(:image) { DXRubySDL::Image.new(640, 480) }

  describe '.new' do
    context '幅と高さを指定した場合' do
      subject { image }

      its(:width) { should eq(640) }
      its(:height) { should eq(480) }
    end
  end

  describe '.load' do
    subject {
      path = File.expand_path("../../fixtures/#{filename}", __FILE__)
      DXRubySDL::Image.load(path)
    }

    context 'PNG形式のファイルの場合' do
      let(:filename) { 'logo.png' }

      its(:width) { should eq(518) }
      its(:height) { should eq(232) }
    end

    context 'JPG形式のファイルの場合' do
      let(:filename) { 'logo.jpg' }

      its(:width) { should eq(518) }
      its(:height) { should eq(232) }
    end
  end

  describe '#line' do
    it '呼び出すことができる' do
      image.line(0, 0, 100, 100, [255, 255, 255])
    end
  end

  describe '#circle' do
    it '呼び出すことができる' do
      image.circle(50, 50, 25, [255, 255, 255])
    end
  end

  describe '#box' do
    it '呼び出すことができる' do
      image.box(0, 0, 100, 100, [255, 255, 255])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dxruby_sdl-0.0.1 spec/dxruby_sdl/image_spec.rb