[Kde-bindings] KDE/kdebindings/qtruby

Caleb Tennis caleb at gentoo.org
Fri Aug 19 15:08:07 UTC 2005


SVN commit 450951 by ctennis:

Qt4ify some of the code in handlers.cpp, and add unit tests.

CCMAIL:kde-bindings at kde.org



 M  +2 -0      ChangeLog  
 M  +4 -4      rubylib/qtruby/handlers.cpp  
 M  +14 -4     rubylib/qtruby/unittests.rb  


--- trunk/KDE/kdebindings/qtruby/ChangeLog #450950:450951
@@ -4,6 +4,8 @@
           verifying QtRuby things are working properly and we don't create
           regressions.
 
+        * Qt4ify some of the code in handlers.cpp
+
 2005-08-19  Richard Dale  <Richard_Dale at tipitina.demon.co.uk>
 
 	* Added various marshallers for converting Qt4 C++ lists to and from
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/handlers.cpp #450950:450951
@@ -89,16 +89,16 @@
 {
 	VALUE obj;
 	
-	const QObjectList l = qobject->children();
+	const QList<QObject*> l = qobject->children();
+	
 	if (l.count() == 0) {
 		return;
 	}
 
-	QObjectList::const_iterator it; // iterate over the children
 	QObject *child;
 
-	for (it = l.constBegin(); it != l.constEnd(); ++it) {
-		child = *it;
+	for (int i=0; i < l.size(); ++i) {
+		child = l.at(i);
 		obj = getPointerObject(child);
 		if (obj != Qnil) {
 			if(do_debug & qtdb_gc) printf("Marking (%s*)%p -> %p\n", child->metaObject()->className(), child, (void*)obj);
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/unittests.rb #450950:450951
@@ -1,12 +1,22 @@
-require 'qtruby'
+require 'Qt'
 require 'test/unit'
 
 class TestQtRuby < Test::Unit::TestCase
 
+  def setup
+    @app = Qt::Application.instance || Qt::Application.new(ARGV)
+    assert @app
+  end
+
   def test_link_against_qt4
-    app = Qt::Application.new(ARGV)
-    assert app
-    assert_raise(NoMethodError) { app.setMainWidget(nil) }
+    assert_raise(NoMethodError) { @app.setMainWidget(nil) }
   end
 
+  def test_widget_inheritance
+    widget = Qt::Widget.new(nil)
+    assert widget.inherits("Qt::Widget")
+    assert widget.inherits("Qt::Object")
+    assert widget.inherits("QObject")
+  end
+
 end



More information about the Kde-bindings mailing list