Sha256: cec2c99f79b9a0d676ef93c0896d6afda7da553da61f46eda2788f59f298e245

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

require "test_helper"

class Mathematical::PNGTest < Test::Unit::TestCase
  def before
    File.delete("#{fixtures_dir}/png/pmatrix.png") if File.exist?("#{fixtures_dir}/png/pmatrix.png")
  end

  def test_it_creates_a_png
    string = '''
    $$
\begin{pmatrix}
     1 & a_1 & a_1^2 & \cdots & a_1^n \\\\
     1 & a_2 & a_2^2 & \cdots & a_2^n \\\\
     \vdots  & \vdots& \vdots & \ddots & \vdots \\\\
     1 & a_m & a_m^2 & \cdots & a_m^n
     \end{pmatrix}
$$
'''
    render = Mathematical.new({:format => :png})
    data_hash = render.render(string)
    header = data_hash[:data].unpack('H*').first.slice(0, 18)
    File.open("#{fixtures_dir}/png/pmatrix.png", 'w') { |f| f.write(data_hash[:data])}
    assert_equal header, '89504e470d0a1a0a00'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mathematical-1.1.1 test/mathematical/png_test.rb
mathematical-1.1.0 test/mathematical/png_test.rb