seed r145 - trunk/tests
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r145 - trunk/tests
- Date: Thu, 6 Nov 2008 15:10:29 +0000 (UTC)
Author: racarr
Date: Thu Nov 6 15:10:29 2008
New Revision: 145
URL: http://svn.gnome.org/viewvc/seed?rev=145&view=rev
Log:
Add subclass test. Also tests sub-sub-classing, and that subclassing
from non GObjects does't crash things.
Added:
trunk/tests/subclass.js (contents, props changed)
Modified:
trunk/tests/Makefile.am
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Thu Nov 6 15:10:29 2008
@@ -16,6 +16,7 @@
signal.js \
syntax-test.js \
type-conversion.js \
+ subclass.js \
native-closure.js
Added: trunk/tests/subclass.js
==============================================================================
--- (empty file)
+++ trunk/tests/subclass.js Thu Nov 6 15:10:29 2008
@@ -0,0 +1,45 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:Found a fooed widget
+// STDERR:
+Seed.import_namespace("Gtk");
+
+Gtk.init(null, null);
+
+function HelloLabel()
+{
+ this.gobject_parent = new Gtk.Label({label: "Hello World"});
+}
+
+function FooedHelloLabel()
+{
+ this.gobject_parent = new HelloLabel();
+ this.fooed = true;
+}
+
+function NotALabel()
+{
+ this.gobject_parent = 3;
+}
+
+var w = new Gtk.Window();
+var vbox = new Gtk.VBox();
+w.add(vbox);
+vbox.pack([{child: new FooedHelloLabel()}, {child: new HelloLabel()}]);
+
+// Just make sure this doesn't crash.
+try
+{
+ vbox.pack_start(new NotALabel());
+} catch (e){}
+
+// Verify that we get the sub-object ref out, not the actual gobject wrapper.
+vbox.foreach(function(widget)
+ {
+ if (widget.fooed == true)
+ {
+ Seed.print("Found a fooed widget");
+ }
+ });
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]