Class/Module Index [+]

Quicksearch

TestGLib

Public Instance Methods

test_convert() click to toggle source
# File glib2/test/test_glib2.rb, line 31
def test_convert
  assert_kind_of(String, GLib.charset)

  sjis = "\2202\2261\2202\3361\2202\3311\2202\2277\2202\3315\2220\2242\2212E"
  euc  = "\2244\2263\2244\3363\2244\3313\2244\3301\2244\3317\3300\2244\2263\2246"
  utf8 = "\3343\2201\2223\3343\2202\2223\3343\2201\2253\3343\2201\2241\3343\2201\2257\3344\2270\2226\3347\2225\2214"
  assert_equal(GLib.convert(sjis, "UTF-8", "SHIFT_JIS"), utf8)
  assert_equal(GLib.convert(sjis, "EUC-JP", "SHIFT_JIS"), euc)
  assert_equal(GLib.convert(sjis, "SHIFT_JIS", "SHIFT_JIS"), sjis)
  assert_equal(GLib.convert(euc, "UTF-8", "EUC-JP"), utf8)
  assert_equal(GLib.convert(euc, "EUC-JP", "EUC-JP"), euc)
  assert_equal(GLib.convert(euc, "SHIFT_JIS", "EUC-JP"), sjis)
  assert_equal(GLib.convert(utf8, "UTF-8", "UTF-8"), utf8)
  assert_equal(GLib.convert(utf8, "EUC-JP", "UTF-8"), euc)
  assert_equal(GLib.convert(utf8, "SHIFT_JIS", "UTF-8"), sjis)

  # rb_define_module_function(mGLib, "locale_to_utf8", rbglib_m_locale_to_utf8, 1);
  # rb_define_module_function(mGLib, "locale_from_utf8", rbglib_m_locale_from_utf8, 1);
  # rb_define_module_function(mGLib, "filename_to_utf8", rbglib_m_filename_to_utf8, 1);
  # rb_define_module_function(mGLib, "filename_from_utf8", rbglib_m_filename_from_utf8, 1);
  # 
  # rb_define_module_function(mGLib, "filename_to_uri", rbglib_m_filename_to_uri, -1);
  # rb_define_module_function(mGLib, "filename_from_uri", rbglib_m_filename_from_uri, 1);

end
test_gtype() click to toggle source
# File glib2/test/test_glib2.rb, line 113
def test_gtype
  assert_equal(GLib::Object.gtype, GLib::Type["GObject"])
  assert_equal(GLib::Interface.gtype, GLib::Type["GInterface"])

  obj = GLib::Object.new
  assert_equal(obj.gtype, GLib::Object.gtype)
end
test_int64() click to toggle source
# File glib2/test/test_glib2.rb, line 28
def test_int64
end
test_interface_extend() click to toggle source
# File glib2/test/test_glib2.rb, line 72
def test_interface_extend
  assert_raises(TypeError){
    Object.__send__(:include, GLib::TypePlugin)
  }
end
test_messages() click to toggle source
# File glib2/test/test_glib2.rb, line 57
def test_messages
  #rb_define_module_function(mGLog, "set_handler", rbglib_m_log_set_handler, 2);
  #rb_define_module_function(mGLog, "remove_handler", rbglib_m_log_remove_handler, 2);
end
test_object() click to toggle source
# File glib2/test/test_glib2.rb, line 62
def test_object
  assert_raises(GLib::NoPropertyError) {
    GLib::Object.property("foo")
  }

  assert_raises(GLib::NoSignalError) {
    GLib::Object.signal("foo")
  }
end
test_priority() click to toggle source
# File glib2/test/test_glib2.rb, line 20
def test_priority
  assert_kind_of(Integer, GLib::PRIORITY_HIGH)
  assert_kind_of(Integer, GLib::PRIORITY_DEFAULT)
  assert_kind_of(Integer, GLib::PRIORITY_HIGH_IDLE)
  assert_kind_of(Integer, GLib::PRIORITY_DEFAULT_IDLE)
  assert_kind_of(Integer, GLib::PRIORITY_LOW)
end
test_signal_handler_disconnect_and_gc() click to toggle source
# File glib2/test/test_glib2.rb, line 99
def test_signal_handler_disconnect_and_gc
  obj = GLib::Object.new
  klass = Class.new
  1000.times {
    a = klass.new
    id = obj.signal_connect("notify") { p a }
    obj.signal_handler_disconnect(id)
  }
  GC.start
  ary = []
  ObjectSpace.each_object(klass) { |a| ary.push(a) }
  assert_operator(ary.size, :<, 1000)
end
test_signal_has_handler_pending() click to toggle source
# File glib2/test/test_glib2.rb, line 78
def test_signal_has_handler_pending
  obj = GLib::Object.new
  signal_name = "notify"

  assert(!obj.signal_has_handler_pending?(signal_name))

  h = obj.signal_connect(signal_name){}
  assert(obj.signal_has_handler_pending?(signal_name))

  obj.signal_handler_block(h) {
    assert(obj.signal_has_handler_pending?(signal_name, true))
    assert(!obj.signal_has_handler_pending?(signal_name, false))
  }
  assert(obj.signal_has_handler_pending?(signal_name, false))

  obj.signal_handler_disconnect(h)
  assert(!obj.signal_has_handler_pending?(signal_name))

  obj = nil
end
test_version() click to toggle source
# File glib2/test/test_glib2.rb, line 6
def test_version
  assert_kind_of(Array, GLib::VERSION)
  assert_equal(GLib::VERSION.length, 3)
  assert(GLib::VERSION.all?{|i| i.is_a? Integer })

  assert_kind_of(Integer, GLib::MAJOR_VERSION)
  assert_kind_of(Integer, GLib::MINOR_VERSION)
  assert_kind_of(Integer, GLib::MICRO_VERSION)

  assert_kind_of(Array, GLib::BINDING_VERSION)
  assert_equal(GLib::BINDING_VERSION.length, 3)
  assert(GLib::BINDING_VERSION.all?{|i| i.is_a? Integer })
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.