Sha256: 3a51f5f5126266060a30841aefbad84f91a56a6919f280e1f0166506eb45c1f4
Contents?: true
Size: 891 Bytes
Versions: 19
Compression:
Stored size: 891 Bytes
Contents
# -*- encoding: utf-8 -*- require 'test_helper' require 'hexapdf/content/processor' module TestHelper # Can be used to to record operators parsed from content streams. class OperatorRecorder < HexaPDF::Content::Processor undef :paint_xobject attr_reader :recorded_ops def initialize super operators.clear @recorded_ops = [] end def respond_to_missing?(*) true end def method_missing(msg, *params) @recorded_ops << (params.empty? ? [msg] : [msg, params]) end end # Asserts that the content string contains the operators. def assert_operators(content, operators, only_names: false) processor = TestHelper::OperatorRecorder.new HexaPDF::Content::Parser.new.parse(content, processor) result = processor.recorded_ops result.map!(&:first) if only_names assert_equal(operators, result) end end
Version data entries
19 entries across 19 versions & 1 rubygems