Sha256: e659015e5caa0e3b275f0bb86f3267d694693d98c12cd5378643f66bdb6bc832
Contents?: true
Size: 788 Bytes
Versions: 3
Compression:
Stored size: 788 Bytes
Contents
require "test_helper" require 'benchmark' class Mathematical::PNGTest < Test::Unit::TestCase def before File.delete("#{fixtures_dir}/png/pmatrix.png") if File.exists?("#{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::Render.new({:format => "png"}) data_hash = render.render(string) header = data_hash["png"].unpack('H*').first.slice(0, 18) File.open("#{fixtures_dir}/png/pmatrix.png", "w") { |f| f.write(data_hash["png"])} assert_equal header, "89504e470d0a1a0a00" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mathematical-0.6.1 | test/mathematical/png_test.rb |
mathematical-0.6.0 | test/mathematical/png_test.rb |
mathematical-0.5.0 | test/mathematical/png_test.rb |