File: test_special.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 (42 lines) | stat: -rw-r--r-- 1,164 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
31
32
33
34
35
36
37
38
39
40
41
42
# -- encoding: utf-8 --
require 'helpers_for_test'

class TestSpecial < TestCase

  include TempfileTest

  CAPTION_ABSTRACT =  'Some text for caption abstract'

  def setup
    super
    @org_filename = @data_dir + '/Canon.jpg'
    FileUtils.cp @org_filename, @temp_filename
    @canon = MiniExiftool.new @temp_filename
  end

  # Catching bug [#8073]
  # Thanks to Eric Young
  def test_special_chars
    assert_not_nil @canon['Self-timer']
    assert_not_nil @canon.self_timer
    # preserving the original tag name
    assert @canon.tags.include?('Self-timer') || @canon.tags.include?('SelfTimer')
    assert !@canon.tags.include?('self_timer')
  end

  # Catching bug with writing caption-abstract
  # Thanks to Robin Romahn
  def test_caption_abstract_sensitive
    @canon['caption-abstract'] = CAPTION_ABSTRACT
    assert @canon.changed_tags.include?('Caption-Abstract')
    assert @canon.save
    assert_equal CAPTION_ABSTRACT, @canon.caption_abstract
  end

  def test_caption_abstract_non_sesitive
    @canon.caption_abstract = CAPTION_ABSTRACT.reverse
    assert @canon.save
    assert_equal CAPTION_ABSTRACT.reverse, @canon.caption_abstract
  end

end