com gtk/php-gtk: Fixing NTRVNRP method GtkCellView::get_s ize_of_row(): TODO2 ext/gtk+/gtktreeview.over rides test/unittests/GtkCellViewTest.php

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    9cac2eb314593557ba07ccf1565572fb63e40211
Author:    Christian Weiske <[email protected]>         Fri, 30 Jun 2006 22:01:19 +0000
Parents:   ed1685f89ed1c2a4a3f0026ac792378f56527311
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=9cac2eb314593557ba07ccf1565572fb63e40211

Log:
Fixing NTRVNRP method GtkCellView::get_size_of_row()

Changed paths:
  M  TODO2
  M  ext/gtk+/gtktreeview.overrides
  M  test/unittests/GtkCellViewTest.php


Diff:
9cac2eb314593557ba07ccf1565572fb63e40211
diff --git a/TODO2 b/TODO2
index 14f70a5..02b922e 100644
--- a/TODO2
+++ b/TODO2
@@ -24,8 +24,6 @@ Base Functionality
 
 Classes and Functions
 ~~~~~~~~~~~~~~~~~~~~~
-* GtkCellView
-    get_size_of_row NTRVNRP
 * GtkClipboard
 	method      GtkClipboard::request_contents: unknown type 'GtkClipboardReceivedFunc'
 	method      GtkClipboard::request_targets: unknown type 'GtkClipboardTargetsReceivedFunc'
diff --git a/ext/gtk+/gtktreeview.overrides b/ext/gtk+/gtktreeview.overrides
index 7083589..600b068 100644
--- a/ext/gtk+/gtktreeview.overrides
+++ b/ext/gtk+/gtktreeview.overrides
@@ -190,6 +190,40 @@ PHP_METHOD
     g_list_free(list);
 }
 
+%%
+add-arginfo GtkCellLayout get_size_of_row
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+    ZEND_ARG_INFO(0, path)
+ZEND_END_ARG_INFO();
+
+%%
+override gtk_cell_view_get_size_of_row
+PHP_METHOD
+{
+    GtkTreePath *path;
+    zval *php_path;
+    GtkRequisition requisition;
+    gboolean php_retval;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "V", &php_path))
+        return;
+
+    if (phpg_tree_path_from_zval(php_path, &path TSRMLS_CC) == FAILURE) {
+        php_error(E_WARNING, "%s::%s() expects path to be a valid tree path specification", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
+        return;
+    }
+
+    php_retval = gtk_cell_view_get_size_of_row(GTK_CELL_VIEW(PHPG_GOBJECT(this_ptr)), path, &requisition);
+
+    if (path)
+        gtk_tree_path_free(path);
+
+    phpg_gboxed_new(&return_value, GTK_TYPE_REQUISITION, &requisition, TRUE, TRUE TSRMLS_CC);
+}
+
 %% }}}
 
 %% {{{ GtkListStore
diff --git a/test/unittests/GtkCellViewTest.php b/test/unittests/GtkCellViewTest.php
index 21b17a5..25ff378 100644
--- a/test/unittests/GtkCellViewTest.php
+++ b/test/unittests/GtkCellViewTest.php
@@ -37,6 +37,12 @@ class GtkCellViewTest extends PHPUnit2_Framework_TestCase {
      * @access protected
      */
     protected function setUp() {
+        $this->cv = new GtkCellView();
+        $mod = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING);
+        $this->cv->set_model($mod);
+        $mod->append(array('a', '1'));
+        $mod->append(array('b', '2'));
+        $mod->append(array('c', '3'));
     }
 
     /**
@@ -65,11 +71,13 @@ class GtkCellViewTest extends PHPUnit2_Framework_TestCase {
     }
 
     /**
-     * @todo Implement testGet_size_of_row().
+     *
      */
     public function testGet_size_of_row() {
-        // Remove the following line when you implement this test.
-        throw new PHPUnit2_Framework_IncompleteTestError;
+        //path 0 is first row
+        $req = $this->cv->get_size_of_row('0');
+        $this->assertNotNull($req);
+        $this->assertType('GtkRequisition', $req);
     }
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.