# File gstreamer/tests/tc_element.rb, line 23
    def test_element
        assert_instance_of(Gst::Element, e  = Gst::ElementFactory.make("fakesrc"))
        assert_instance_of(Gst::Element, e2 = Gst::ElementFactory.make("fakesrc", "plok"))
        e.test(self); e2.test(self)
        # Test states 
        state  = Struct.new("State", :code, :get, :set)
        states = [
                state.new(Gst::Element::STATE_READY  , "e.ready?",   "e.ready"),
                state.new(Gst::Element::STATE_PLAYING, "e.playing?", "e.play" ),
                state.new(Gst::Element::STATE_PAUSED , "e.paused?",  "e.pause"),
                state.new(Gst::Element::STATE_NULL   , "e.stopped?", "e.stop" )
        ]       
        valid_codes = [ 
            Gst::Element::STATE_FAILURE,
            Gst::Element::STATE_SUCCESS,
            Gst::Element::STATE_ASYNC
        ] 
        states.each do |state|
            assert_instance_of(Fixnum, state.code)
            assert_instance_of(Fixnum, code = eval(state.set))
            assert valid_codes.include?(code)
            assert_equal(code, Gst::Element::STATE_SUCCESS)
            assert_instance_of(Fixnum, s = e.state)
            assert_equal(s, state.code)
            assert eval(state.get)
            states.each do | state2|
                next if state.code == state2.code
                assert !eval(state2.get)
            end
        end
        # Test properties
        e.each_property do |key, descr, val|
            assert_instance_of(String, key)
            assert_instance_of(String, descr)
            assert_equal(e.get_property(key), val)
            #assert_equal(eval("e.#{key}"), val)
        end
        assert_raises(ArgumentError) do 
            e.get_property("does_not_exist")
        end
        assert_instance_of(String, n = e.get_property("name"))
        assert_equal(e.set_property("name", "foo"), e)
        assert_equal(e.get_property("name"), "foo")
        assert_equal(e.name = n, n)
    end