com gtk/php-gtk: Adding last missing GtkBox method: query_child_packing and unit tests for GtkBox: :query_child_packing and GtkNotebook::query_tab _label_packing: ext/gtk+/gtk.overrides test/unittes ts/GtkBoxTest.php test/unittests/GtkNotebookTest.php
[email protected] (David Soria Parra)
| Newsgroups | php.gtk.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 997d681d0edc0f88bd8d37f732d5e4667c12e6a7 Author: Christian Weiske <[email protected]> Thu, 1 Jun 2006 05:58:53 +0000 Parents: 9a633280a93f390caac4ed0ba28f956997da86e1 Branches: master Link: http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=997d681d0edc0f88bd8d37f732d5e4667c12e6a7 Log: Adding last missing GtkBox method: query_child_packing and unit tests for GtkBox::query_child_packing and GtkNotebook::query_tab_label_packing Changed paths: M ext/gtk+/gtk.overrides M test/unittests/GtkBoxTest.php M test/unittests/GtkNotebookTest.php Diff: 997d681d0edc0f88bd8d37f732d5e4667c12e6a7 diff --git a/ext/gtk+/gtk.overrides b/ext/gtk+/gtk.overrides index cb0bef1..26e0e47 100644 --- a/ext/gtk+/gtk.overrides +++ b/ext/gtk+/gtk.overrides @@ -905,6 +905,35 @@ PHP_METHOD %% }}} +%% {{{ GtkBox + +%% +add-arginfo GtkBox query_child_packing +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_OBJ_INFO(0, child, GtkWidget, 1) +ZEND_END_ARG_INFO(); + +%% +override gtk_box_query_child_packing +PHP_METHOD +{ + zval *php_child; + gboolean expand, fill; + guint padding; + GtkPackType pack_type; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "N", &php_child, gtkwidget_ce)) + return; + + gtk_box_query_child_packing(GTK_BOX(PHPG_GOBJECT(this_ptr)), GTK_WIDGET(PHPG_GOBJECT(php_child)), &expand, &fill, &padding, &pack_type); + php_gtk_build_value(&return_value, "(bbii)", expand, fill, padding, pack_type); +} + +%% }}} + %% {{{ GtkButton %% diff --git a/test/unittests/GtkBoxTest.php b/test/unittests/GtkBoxTest.php index fbeb260..4d61c19 100644 --- a/test/unittests/GtkBoxTest.php +++ b/test/unittests/GtkBoxTest.php @@ -97,6 +97,33 @@ class GtkBoxTest extends PHPUnit2_Framework_TestCase { } /** + * + */ + public function testQuery_child_packing() { + $vb = new GtkVBox(); + $vb->pack_start($c1 = new GtkLabel('Page 1'), true, true, 0); + list($expand, $fill, $padding, $pack_type) = $vb->query_child_packing($c1); + $this->assertTrue($expand); + $this->assertTrue($fill); + $this->assertEquals(0, $padding); + $this->assertEquals(Gtk::PACK_START, $pack_type); + + $vb->pack_start($c2 = new GtkLabel('Page 2'), true, false, 10); + list($expand, $fill, $padding, $pack_type) = $vb->query_child_packing($c2); + $this->assertTrue($expand); + $this->assertFalse($fill); + $this->assertEquals(10, $padding); + $this->assertEquals(Gtk::PACK_START, $pack_type); + + $vb->pack_end($c3 = new GtkLabel('Page 3'), false, false, 1000); + list($expand, $fill, $padding, $pack_type) = $vb->query_child_packing($c3); + $this->assertFalse($expand); + $this->assertFalse($fill); + $this->assertEquals(1000, $padding); + $this->assertEquals(Gtk::PACK_END, $pack_type); + } + + /** * @todo Implement testReorder_child(). */ public function testReorder_child() { diff --git a/test/unittests/GtkNotebookTest.php b/test/unittests/GtkNotebookTest.php index 9a1903d..ad89047 100644 --- a/test/unittests/GtkNotebookTest.php +++ b/test/unittests/GtkNotebookTest.php @@ -233,6 +233,38 @@ class GtkNotebookTest extends PHPUnit2_Framework_TestCase { } /** + * + */ + public function testQuery_tab_label_packing() { + $nb = new GtkNotebook(); + $nb->append_page($c1 = new GtkLabel('Page 1'), new GtkLabel('Tab 1')); + $nb->set_tab_label_packing($c1, true, true, Gtk::PACK_START); + list($expand, $fill, $pack_type) = $nb->query_tab_label_packing($c1); + + $this->assertTrue($expand); + $this->assertTrue($fill); + $this->assertEquals(Gtk::PACK_START, $pack_type); + + + $nb->append_page($c2 = new GtkLabel('Page 2'), new GtkLabel('Tab 2')); + $nb->set_tab_label_packing($c2, true, false, Gtk::PACK_START); + list($expand, $fill, $pack_type) = $nb->query_tab_label_packing($c2); + + $this->assertTrue($expand); + $this->assertFalse($fill); + $this->assertEquals(Gtk::PACK_START, $pack_type); + + + $nb->prepend_page($c3 = new GtkLabel('Page 3'), new GtkLabel('Tab 3')); + $nb->set_tab_label_packing($c3, false, false, Gtk::PACK_END); + list($expand, $fill, $pack_type) = $nb->query_tab_label_packing($c3); + + $this->assertFalse($expand); + $this->assertFalse($fill); + $this->assertEquals(Gtk::PACK_END, $pack_type); + } + + /** * @todo Implement testRemove_page(). */ public function testRemove_page() {