cvs: php-gtk / TODO2 /ext/gtk+ gtktextview.overrides gtktreeview.overrides /test/unittests GtkTextBufferTest.php GtkTextViewTest.php
GtkTreeViewTest.php

From: Date: Tue, 07 Mar 2006 12:39:26 +0000
Subject: cvs: php-gtk / TODO2 /ext/gtk+ gtktextview.overrides gtktreeview.overrides /test/unittests GtkTextBufferTest.php GtkTextViewTest.php
GtkTreeViewTest.php
Groups: php.gtk.cvs 
Request: Send a blank email to php-gtk-cvs+get-2171@lists.php.net to get a copy of this message
cweiske Tue Mar 7 12:39:26 2006 UTC Modified files: /php-gtk/ext/gtk+ gtktreeview.overrides gtktextview.overrides /php-gtk TODO2 /php-gtk/test/unittests GtkTextBufferTest.php GtkTextViewTest.php GtkTreeViewTest.php Log: Fixed some NTRVNRP methods and added unit tests for them

http://cvs.php.net/viewcvs.cgi/php-gtk/ext/gtk+/gtktreeview.overrides?r1=1.36&r2=1.37&diff_format=u Index: php-gtk/ext/gtk+/gtktreeview.overrides diff -u php-gtk/ext/gtk+/gtktreeview.overrides:1.36 php-gtk/ext/gtk+/gtktreeview.overrides:1.37 --- php-gtk/ext/gtk+/gtktreeview.overrides:1.36 Sat Mar 4 21:02:35 2006 +++ php-gtk/ext/gtk+/gtktreeview.overrides Tue Mar 7 12:39:26 2006 @@ -1323,6 +1323,22 @@ %% +override gtk_tree_view_get_visible_rect +PHP_METHOD +{ + GdkRectangle rect; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) + return; + + gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(PHPG_GOBJECT(this_ptr)), &rect); + phpg_gboxed_new(&return_value, GDK_TYPE_RECTANGLE, &rect, TRUE, TRUE TSRMLS_CC); +} + + +%% add-arginfo GtkTreeView tree_to_widget_coords static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) http://cvs.php.net/viewcvs.cgi/php-gtk/ext/gtk+/gtktextview.overrides?r1=1.8&r2=1.9&diff_format=u Index: php-gtk/ext/gtk+/gtktextview.overrides diff -u php-gtk/ext/gtk+/gtktextview.overrides:1.8 php-gtk/ext/gtk+/gtktextview.overrides:1.9 --- php-gtk/ext/gtk+/gtktextview.overrides:1.8 Fri Feb 24 04:38:53 2006 +++ php-gtk/ext/gtk+/gtktextview.overrides Tue Mar 7 12:39:26 2006 @@ -9,6 +9,48 @@ %% {{{ GtkTextBuffer %% +override gtk_text_buffer_get_bounds +PHP_METHOD +{ + GtkTextIter start, end; + zval *php_start = NULL; + zval *php_end = NULL; + + NOT_STATIC_METHOD(); + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) + return; + + gtk_text_buffer_get_bounds(GTK_TEXT_BUFFER(PHPG_GOBJECT(this_ptr)), &start, &end); + + phpg_gboxed_new(&php_start, GTK_TYPE_TEXT_ITER, &start, TRUE, TRUE TSRMLS_CC); + phpg_gboxed_new(&php_end, GTK_TYPE_TEXT_ITER, &end, TRUE, TRUE TSRMLS_CC); + + php_gtk_build_value(&return_value, "(NN)", php_start, php_end); +} + +%% +override gtk_text_buffer_get_selection_bounds +PHP_METHOD +{ + GtkTextIter start, end; + zval *php_start = NULL; + zval *php_end = NULL; + + NOT_STATIC_METHOD(); + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) + return; + + if (gtk_text_buffer_get_selection_bounds(GTK_TEXT_BUFFER(PHPG_GOBJECT(this_ptr)), &start, &end)) { + phpg_gboxed_new(&php_start, GTK_TYPE_TEXT_ITER, &start, TRUE, TRUE TSRMLS_CC); + phpg_gboxed_new(&php_end, GTK_TYPE_TEXT_ITER, &end, TRUE, TRUE TSRMLS_CC); + + php_gtk_build_value(&return_value, "(NN)", php_start, php_end); + } else { + RETURN_FALSE; + } +} + +%% override gtk_text_buffer_get_start_iter PHP_METHOD { @@ -203,6 +245,32 @@ %% +add-arginfo GtkTextView get_iter_at_location +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO(); + +%% +override gtk_text_view_get_iter_at_location +PHP_METHOD +{ + gint x, y; + GtkTextIter iter; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "ii", &x, &y)) + return; + + gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(PHPG_GOBJECT(this_ptr)), &iter, x, y); + + phpg_gboxed_new(&return_value, GTK_TYPE_TEXT_ITER, &iter, TRUE, TRUE TSRMLS_CC); +} + + +%% add-arginfo GtkTextView get_iter_at_position static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) @@ -232,6 +300,35 @@ %% +add-arginfo GtkTextView get_iter_location +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_OBJ_INFO(0, iter, GtkTextIter, 0) +ZEND_END_ARG_INFO(); + +%% +override gtk_text_view_get_iter_location +PHP_METHOD +{ + zval *php_iter = NULL; + GtkTextIter *iter = NULL; + GdkRectangle rect; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "O", &php_iter, gtktextiter_ce)) + return; + + if (php_iter && IS_OBJECT == Z_TYPE_P(php_iter)) { + iter = (GtkTextIter *) PHPG_GBOXED(php_iter); + } + + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(PHPG_GOBJECT(this_ptr)), iter, &rect); + phpg_gboxed_new(&return_value, GDK_TYPE_RECTANGLE, &rect, TRUE, TRUE TSRMLS_CC); +} + + +%% add-arginfo GtkTextView get_line_at_y static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) @@ -287,6 +384,20 @@ php_gtk_build_value(&return_value, "(ii)", y, height); } +%% +override gtk_text_view_get_visible_rect +PHP_METHOD +{ + GdkRectangle rect; + + NOT_STATIC_METHOD(); + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) + return; + + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(PHPG_GOBJECT(this_ptr)), &rect); + phpg_gboxed_new(&return_value, GDK_TYPE_RECTANGLE, &rect, TRUE, TRUE TSRMLS_CC); +} %% add-arginfo GtkTextView window_to_buffer_coords http://cvs.php.net/viewcvs.cgi/php-gtk/TODO2?r1=1.68&r2=1.69&diff_format=u Index: php-gtk/TODO2 diff -u php-gtk/TODO2:1.68 php-gtk/TODO2:1.69 --- php-gtk/TODO2:1.68 Mon Mar 6 21:55:06 2006 +++ php-gtk/TODO2 Tue Mar 7 12:39:26 2006 @@ -76,13 +76,7 @@ with their _menu counterparts (so that append_page accepts a third parameter from append_page_menu) * GtkTextBuffer - get_bounds NTRVNRP get_iter_at_child_anchor NTRVNRP - get_selection_bounds NTRVNRP -* GtkTextView - get_iter_at_location NTRVNRP - get_iter_location NTRVNRP - get_visible_rect NTRVNRP * GtkTreeModel method GtkTreeModel::get: varargs methods not supported method GtkTreeModel::get_valist: unknown type 'va_list' @@ -109,7 +103,6 @@ method GtkTreeView::set_search_equal_func: unknown type 'GtkTreeViewSearchEqualFunc' method GtkTreeView::tree_to_widget_coords: unknown type 'gint*' method GtkTreeView::widget_to_tree_coords: unknown type 'gint*' - get_visible_rect NTRVNRP * GtkTextBuffer method GtkTextBuffer::create_tag: varargs methods not supported method GtkTextBuffer::insert_with_tags: varargs methods not supported http://cvs.php.net/viewcvs.cgi/php-gtk/test/unittests/GtkTextBufferTest.php?r1=1.1&r2=1.2&diff_format=u Index: php-gtk/test/unittests/GtkTextBufferTest.php diff -u php-gtk/test/unittests/GtkTextBufferTest.php:1.1 php-gtk/test/unittests/GtkTextBufferTest.php:1.2 --- php-gtk/test/unittests/GtkTextBufferTest.php:1.1 Tue Mar 7 12:36:29 2006 +++ php-gtk/test/unittests/GtkTextBufferTest.php Tue Mar 7 12:39:26 2006 @@ -10,11 +10,11 @@ // You may remove the following line when all tests have been implemented. require_once "PHPUnit2/Framework/IncompleteTestError.php"; -require_once ""; +//require_once ""; /** * Test class for GtkTextBuffer. - * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 13:26:41. + * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 11:37:05. */ class GtkTextBufferTest extends PHPUnit2_Framework_TestCase { /** @@ -37,6 +37,7 @@ * @access protected */ protected function setUp() { + $this->tb = new GtkTextBuffer(); } /** @@ -169,11 +170,16 @@ } /** - * @todo Implement testGet_bounds(). + * get_bounds should return an array with start and end iterator */ public function testGet_bounds() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + $this->tb->set_text('Hello world'); + $ar = $this->tb->get_bounds(); + $this->assertTrue(is_array($ar)); + $this->assertEquals(2, count($ar)); + $this->assertEquals('GtkTextIter', get_class($ar[0])); + $this->assertEquals('GtkTextIter', get_class($ar[1])); + $this->assertEquals('Hello world', $this->tb->get_text($ar[0], $ar[1])); } /** @@ -281,11 +287,28 @@ } /** - * @todo Implement testGet_selection_bounds(). + * selection bounds with selection */ public function testGet_selection_bounds() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + //Something selected -> should return array + $this->tb->set_text('Hello world'); + $this->tb->select_range($this->tb->get_start_iter(), $this->tb->get_end_iter()); + $ar = $this->tb->get_selection_bounds(); + $this->assertTrue(is_array($ar)); + $this->assertEquals(2, count($ar)); + $this->assertEquals('GtkTextIter', get_class($ar[0])); + $this->assertEquals('GtkTextIter', get_class($ar[1])); + $this->assertEquals('Hello world', $this->tb->get_text($ar[0], $ar[1])); + } + + /** + * selection bounds with no selection + */ + public function testGet_selection_boundsNoSelection() { + //Something selected -> should return array + $this->tb->set_text('Hello world'); + $ar = $this->tb->get_selection_bounds(); + $this->assertFalse($ar); } /** http://cvs.php.net/viewcvs.cgi/php-gtk/test/unittests/GtkTextViewTest.php?r1=1.1&r2=1.2&diff_format=u Index: php-gtk/test/unittests/GtkTextViewTest.php diff -u php-gtk/test/unittests/GtkTextViewTest.php:1.1 php-gtk/test/unittests/GtkTextViewTest.php:1.2 --- php-gtk/test/unittests/GtkTextViewTest.php:1.1 Tue Mar 7 12:36:29 2006 +++ php-gtk/test/unittests/GtkTextViewTest.php Tue Mar 7 12:39:26 2006 @@ -10,11 +10,9 @@ // You may remove the following line when all tests have been implemented. require_once "PHPUnit2/Framework/IncompleteTestError.php"; -require_once ""; - /** * Test class for GtkTextView. - * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 13:26:41. + * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 11:37:05. */ class GtkTextViewTest extends PHPUnit2_Framework_TestCase { /** @@ -37,6 +35,7 @@ * @access protected */ protected function setUp() { + $this->tv = new GtkTextView(); } /** @@ -164,8 +163,9 @@ * @todo Implement testGet_iter_at_location(). */ public function testGet_iter_at_location() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + $iter = $this->tv->get_iter_at_location(0,0); + $this->assertEquals('GtkTextIter', get_class($iter)); + $this->assertNotNull($iter); } /** @@ -177,11 +177,18 @@ } /** - * @todo Implement testGet_iter_location(). + * */ public function testGet_iter_location() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + $iter = $this->tv->get_buffer()->get_end_iter(); + $this->assertNotNull($iter); + + $rect = $this->tv->get_iter_location($iter); + $this->assertEquals('GdkRectangle', get_class($rect)); + $this->assertNotNull($rect); + //this values *should* be null as the view isn't visible + $this->assertEquals(0, $rect->x); + $this->assertEquals(0, $rect->y); } /** @@ -265,11 +272,17 @@ } /** - * @todo Implement testGet_visible_rect(). + * */ public function testGet_visible_rect() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + $rect = $this->tv->get_visible_rect(); + $this->assertEquals('GdkRectangle', get_class($rect)); + $this->assertNotNull($rect); + //this values *should* be null as the view isn't visible + $this->assertEquals(0, $rect->x); + $this->assertEquals(0, $rect->y); +// $this->assertEquals(0, $rect->width); +// $this->assertEquals(0, $rect->height); } /** http://cvs.php.net/viewcvs.cgi/php-gtk/test/unittests/GtkTreeViewTest.php?r1=1.1&r2=1.2&diff_format=u Index: php-gtk/test/unittests/GtkTreeViewTest.php diff -u php-gtk/test/unittests/GtkTreeViewTest.php:1.1 php-gtk/test/unittests/GtkTreeViewTest.php:1.2 --- php-gtk/test/unittests/GtkTreeViewTest.php:1.1 Tue Mar 7 12:36:29 2006 +++ php-gtk/test/unittests/GtkTreeViewTest.php Tue Mar 7 12:39:26 2006 @@ -10,11 +10,9 @@ // You may remove the following line when all tests have been implemented. require_once "PHPUnit2/Framework/IncompleteTestError.php"; -require_once ""; - /** * Test class for GtkTreeView. - * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 13:26:41. + * Generated by PHPUnit2_Util_Skeleton on 2006-03-07 at 11:37:05. */ class GtkTreeViewTest extends PHPUnit2_Framework_TestCase { /** @@ -37,6 +35,7 @@ * @access protected */ protected function setUp() { + $this->tv = new GtkTreeView(); } /** @@ -265,11 +264,15 @@ } /** - * @todo Implement testGet_visible_rect(). + * */ public function testGet_visible_rect() { - // Remove the following line when you implement this test. - throw new PHPUnit2_Framework_IncompleteTestError; + $rect = $this->tv->get_visible_rect(); + $this->assertEquals('GdkRectangle', get_class($rect)); + $this->assertNotNull($rect); + //this values *should* be null as the view isn't visible + $this->assertEquals(0, $rect->x); + $this->assertEquals(0, $rect->y); } /**
« previous php.gtk.cvs (#2171) next »