File: test_encodings.rb

package info (click to toggle)
ruby-mini-exiftool 2.9.0-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 688 kB
  • sloc: ruby: 2,616; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -- encoding: utf-8 --
require 'helpers_for_test'

class TestEncodings < TestCase

  include TempfileTest

  def setup
    super
    @data_dir = File.dirname(__FILE__) + '/data'
    @filename_test = @data_dir + '/test_encodings.jpg'
    @mini_exiftool = MiniExiftool.new @filename_test
  end

  def test_iptc_encoding
    object_name = "Möhre"
    assert_not_equal object_name, @mini_exiftool.object_name
    correct_iptc = MiniExiftool.new(@filename_test, iptc_encoding: 'MacRoman')
    assert_equal object_name, correct_iptc.object_name
    FileUtils.cp(@filename_test, @temp_filename)
    correct_iptc_write = MiniExiftool.new(@temp_filename, iptc_encoding: 'MacRoman')
    caption = 'Das ist eine Möhre'
    correct_iptc_write.caption_abstract = caption
    correct_iptc_write.save!
    correct_iptc_write.reload
    assert_equal object_name, correct_iptc_write.object_name
    assert_equal caption, correct_iptc_write.caption_abstract
  end

end