# File gstreamer/tests/misc.rb, line 143 def test(tc) # Test as a PluginFeature super(tc) # Test the string representation tc.assert_instance_of(String, to_s) # Test ranks ranks = { Gst::ElementFactory::RANK_MARGINAL => rank_marginal?, Gst::ElementFactory::RANK_NONE => rank_none?, Gst::ElementFactory::RANK_PRIMARY => rank_primary?, Gst::ElementFactory::RANK_SECONDARY => rank_secondary? } tc.assert_instance_of(Fixnum, r = rank) ranks.each do |flag, ok| tc.assert_bool ok tc.assert_instance_of(Fixnum, flag) if ok tc.assert_equal(r, flag) else tc.assert_not_equal(r, flag) end end tc.assert_equal(ranks.values.collect { |v| v if v }.nitems, 1) # Test details tc.assert_instance_of(Hash, h = details) keys = [ "longname", "klass", "license", "description", "version", "author", "copyright" ] keys.each do |key| tc.assert_instance_of(String, h[key]) if h[key] end tc.assert h.keys.size == keys.size # Test pad templates i = 0 each_pad_template { |pad| pad.test(tc); i += 1 } tc.assert_instance_of(Array, a = pad_templates) tc.assert_equal(a.size, i) a.each { |pad| pad.test(tc) } # Test element creation tc.assert_instance_of(Gst::Element, e = create("an_element_#{name}")) e.test(tc) a = Array.new # Test unique auto-generated element names 10.times { a.push(create) } a.each { |e| tc.assert_instance_of(Gst::Element, e) } tc.assert_nil a.collect { |e| e.name }.uniq! end
Generated with the Darkfish Rdoc Generator 2.