Sha256: 36e3d46c1fd173be2afc426e2fc31a54d691e84aff460b082d9eb4b3d074d445
Contents?: true
Size: 1.93 KB
Versions: 6
Compression:
Stored size: 1.93 KB
Contents
require 'spec_helper' require 'yaml' describe Hydra::Derivatives::Processors::Jpeg2kImage do let(:object) { ActiveFedora::Base.new } describe "#calculate_recipe" do it "calculates the number of levels from a size" do dim = 7200 expect(described_class.level_count_for_size(dim)).to eq(6) end it "calculates the compression rates for each quality layer" do compression_num = 10 layers = 8 calc = described_class.layer_rates(layers, compression_num) expect(calc).to eq("2.4,1.48331273,0.91675694,0.56659885,0.3501847,0.21643059,0.13376427,0.0826726") end end describe ".srgb_profile_path" do it "exists" do expect(File.exists?(described_class.srgb_profile_path)).to eq true end end describe "#kdu_compress_recipe" do before(:all) do @sample_cfg = YAML.load_file(File.expand_path('../../fixtures/jpeg2k_config.yml', __FILE__))['test'] Hydra::Derivatives.kdu_compress_recipes = @sample_cfg['jp2_recipes'] end it "can get the recipe from a config file" do args = { recipe: :myrecipe } r = described_class.kdu_compress_recipe(args, 'grey', 7200) expect(r).to eq(@sample_cfg['jp2_recipes'][:myrecipe_grey]) end it "can take a recipe as a string" do args = { recipe: '-my -excellent -recipe' } r = described_class.kdu_compress_recipe(args, 'grey', 7200) expect(r).to eq(args[:recipe]) end it "will fall back to a #calculate_recipe if a symbol is passed but no recipe is found" do args = { recipe: :x } r = described_class.kdu_compress_recipe(args, 'grey', 7200) expect(r).to eq(described_class.calculate_recipe(args, 'grey', 7200)) end it "will fall back to a #calculate_recipe if there is no attempt to provide one" do args = {} r = described_class.kdu_compress_recipe(args, 'grey', 7200) expect(r).to eq(described_class.calculate_recipe(args, 'grey', 7200)) end end end
Version data entries
6 entries across 6 versions & 1 rubygems