test/test_helper.rb in gir_ffi-0.0.5 vs test/test_helper.rb in gir_ffi-0.0.6

- old
+ new

@@ -1,10 +1,13 @@ require 'shoulda' require 'rr' require 'ffi' + $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +require 'gir_ffi' + if RUBY_PLATFORM == 'java' require 'java' JRuby.objectspace = true end @@ -48,7 +51,15 @@ def cleanup_module name if Object.const_defined? name Object.send(:remove_const, name) end + end + + def ref_count object + GObject::Object::Struct.new(object.to_ptr)[:ref_count] + end + + def is_floating? object + (GObject::Object::Struct.new(object.to_ptr)[:qdata].address & 2) == 2 end end