rdvd-slideshow 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  require 'rdvd-slideshow/slideshow'
2
2
 
3
3
  module RDvdSlideshow
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
@@ -63,6 +63,10 @@ module RDvdSlideshow
63
63
  write_line("fadeout",duration,options,[:subtitle])
64
64
  end
65
65
 
66
+ def background(duration,options={})
67
+ write_line("background",duration,options,[:subtitle,:image])
68
+ end
69
+
66
70
  #
67
71
  # Adds an exit command
68
72
  #
@@ -81,6 +85,9 @@ module RDvdSlideshow
81
85
  end
82
86
 
83
87
  def build_line(keyword,duration,options={},sorted_keys=[])
88
+ # Keep only values for authorized keys (defined in sorted_keys)
89
+ options.delete_if { |key, value| !sorted_keys.include?(key) }
90
+ #
84
91
  line = keyword + separator + format_duration(duration)
85
92
  index = 0
86
93
  remaining_options = options.values.length
@@ -95,4 +95,21 @@ class TestSlideshowInput < Test::Unit::TestCase
95
95
  assert_equal "#{default_image}:1.235\n", lines[1]
96
96
  end
97
97
 
98
+ def test_background
99
+ input = RDvdSlideshow::SlideshowInput.new(input_file) do |input|
100
+ input.background(0.5)
101
+ input.background(0.5,{:subtitle=>"my subtitle"})
102
+ input.background(0.5,{:image=>default_image})
103
+ input.background(0.5,{:subtitle=>"my subtitle",:image=>default_image})
104
+ input.background(0.5,{:invalid_option=>"invalid"})
105
+ end
106
+
107
+ lines = File.readlines(input.file_path)
108
+ assert_equal 5, lines.length
109
+ assert_equal "background:0.500\n", lines[0]
110
+ assert_equal "background:0.500:my subtitle\n", lines[1]
111
+ assert_equal "background:0.500::#{default_image}\n", lines[2]
112
+ assert_equal "background:0.500:my subtitle:#{default_image}\n", lines[3]
113
+ assert_equal "background:0.500\n", lines[4]
114
+ end
98
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdvd-slideshow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sdabet
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-13 00:00:00 +01:00
12
+ date: 2009-02-16 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency