[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-gtk-cvs
Subject:    [php-gtk-cvs] com gtk/php-gtk: GtkInfoBar tests: =?UTF-8?Q?tests/GtkInfoBar/=5F=5Fconst?= =?UTF-8?Q?
From:       David Soria Parra <dsp () php ! net>
Date:       2009-10-08 14:47:06
Message-ID: php-mail-40a407d2b8232dcf7b74deab15ad4c2822085626 () git ! php ! net
[Download RAW message or body]

Commit:    e1b7983f3544d1f231bee21b59888cbd42825847
Author:    Elizabeth Marie Smith <auroraeosrose@php.net>         Thu, 8 Oct 2009 14:47:06 +0000
Parents:   a7fc38ed35c9fd44cb32d8e95e3151f907252be2
Branches:  master

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

Log:
GtkInfoBar tests

Changed paths:
  A  tests/GtkInfoBar/__construct.phpt
  A  tests/GtkInfoBar/add_action_widget.phpt
  A  tests/GtkInfoBar/add_button.phpt
  A  tests/GtkInfoBar/get_action_area.phpt
  A  tests/GtkInfoBar/get_content_area.phpt
  A  tests/GtkInfoBar/get_message_type.phpt
  A  tests/GtkInfoBar/response.phpt
  A  tests/GtkInfoBar/set_default_response.phpt
  A  tests/GtkInfoBar/set_message_type.phpt
  A  tests/GtkInfoBar/set_response_sensitive.phpt


["diff_e1b7983f3544d1f231bee21b59888cbd42825847.txt" (text/plain)]

e1b7983f3544d1f231bee21b59888cbd42825847
diff --git a/tests/GtkInfoBar/__construct.phpt b/tests/GtkInfoBar/__construct.phpt
new file mode 100644
index 0000000..182483b
--- /dev/null
+++ b/tests/GtkInfoBar/__construct.phpt
@@ -0,0 +1,30 @@
+--TEST--
+GtkInfoBar->__construct method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!class_exists('GtkInfoBar')) die('skip - GtkInfoBar not available, requires GTK \
2.18 or higher'); +if(!method_exists('GtkInfoBar', '__construct')) die('skip - \
GtkInfoBar->__construct not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$bar = new GtkInfoBar();
+
+var_dump($bar instanceof GtkInfoBar);
+echo $bar;
+
+/* Wrong number args*/
+try {
+    new GtkInfoBar(1);
+    trigger_error('GtkInfoBar did not throw exception');
+} catch (PhpGtkConstructException $e) {
+    echo $e->getMessage();
+}
+
+/* Takes no args, so no arg type checking */
+?>
+--EXPECTF--
+bool(true)
+[GtkInfoBar object (GtkInfoBar Gtk+ type)]
+Warning: GtkInfoBar::__construct() expects exactly 0 parameters, 1 given in %s on \
line %d +could not construct GtkInfoBar object
\ No newline at end of file
diff --git a/tests/GtkInfoBar/add_action_widget.phpt \
b/tests/GtkInfoBar/add_action_widget.phpt new file mode 100644
index 0000000..9c28079
--- /dev/null
+++ b/tests/GtkInfoBar/add_action_widget.phpt
@@ -0,0 +1,17 @@
+--TEST--
+GtkInfoBar->add_action_widget method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'add_action_widget')) die('skip - \
GtkInfoBar->add_action_widget not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->add_action_widget(new GtkButton("test"), 1);
+$ib->add_action_widget();
+?>
+--EXPECTF--
+Warning: GtkInfoBar::add_action_widget() requires exactly 2 arguments, 0 given in %s \
                on line %d
diff --git a/tests/GtkInfoBar/add_button.phpt b/tests/GtkInfoBar/add_button.phpt
new file mode 100644
index 0000000..2140fc2
--- /dev/null
+++ b/tests/GtkInfoBar/add_button.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GtkInfoBar->add_button method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'add_button')) die('skip - GtkInfoBar->add_button \
not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$btn = $ib->add_button("TestButton", 1);
+echo get_class($btn)."\n";
+$ib->add_button();
+?>
+--EXPECTF--
+GtkButton
+
+Warning: GtkInfoBar::add_button() requires exactly 2 arguments, 0 given in %s on \
                line %d
diff --git a/tests/GtkInfoBar/get_action_area.phpt \
b/tests/GtkInfoBar/get_action_area.phpt new file mode 100644
index 0000000..5221819
--- /dev/null
+++ b/tests/GtkInfoBar/get_action_area.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GtkInfoBar->get_action_area method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'get_action_area')) die('skip - \
GtkInfoBar->get_action_area not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+var_dump($ib->get_action_area() instanceof GtkWidget);
+$ib->get_action_area(1);
+?>
+--EXPECTF--
+bool(true)
+
+Warning: GtkInfoBar::get_action_area() expects exactly 0 parameters, 1 given in %s \
on line %d +
diff --git a/tests/GtkInfoBar/get_content_area.phpt \
b/tests/GtkInfoBar/get_content_area.phpt new file mode 100644
index 0000000..23a01e6
--- /dev/null
+++ b/tests/GtkInfoBar/get_content_area.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GtkInfoBar->get_content_area method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'get_content_area')) die('skip - \
GtkInfoBar->get_content_area not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+var_dump($ib->get_content_area() instanceof GtkWidget);
+$ib->get_content_area(1);
+?>
+--EXPECTF--
+bool(true)
+
+Warning: GtkInfoBar::get_content_area() expects exactly 0 parameters, 1 given in %s \
on line %d +
diff --git a/tests/GtkInfoBar/get_message_type.phpt \
b/tests/GtkInfoBar/get_message_type.phpt new file mode 100644
index 0000000..cc4da7d
--- /dev/null
+++ b/tests/GtkInfoBar/get_message_type.phpt
@@ -0,0 +1,21 @@
+--TEST--
+GtkInfoBar->get_message_type method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'get_message_type')) die('skip - \
GtkInfoBar->get_message_type not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->set_message_type(Gtk::MESSAGE_INFO);
+var_dump($ib->get_message_type() == Gtk::MESSAGE_INFO);
+$ib->get_message_type(1);
+?>
+--EXPECTF--
+bool(true)
+
+Warning: GtkInfoBar::get_message_type() expects exactly 0 parameters, 1 given in %s \
on line %d +
diff --git a/tests/GtkInfoBar/response.phpt b/tests/GtkInfoBar/response.phpt
new file mode 100644
index 0000000..cacc6ba
--- /dev/null
+++ b/tests/GtkInfoBar/response.phpt
@@ -0,0 +1,24 @@
+--TEST--
+GtkInfoBar->response method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'response')) die('skip - GtkInfoBar->response not \
available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->add_button("TestButton", 1);
+function test_response ($widget, $id, $data) {
+	var_dump($id == 1);
+}
+$ib->connect("response", "test_response", NULL);
+$ib->response(1);
+$ib->response();
+?>
+--EXPECTF--
+bool(true)
+
+Warning: GtkInfoBar::response() requires exactly 1 argument, 0 given in %s on line \
                %d
diff --git a/tests/GtkInfoBar/set_default_response.phpt \
b/tests/GtkInfoBar/set_default_response.phpt new file mode 100644
index 0000000..1ce63f8
--- /dev/null
+++ b/tests/GtkInfoBar/set_default_response.phpt
@@ -0,0 +1,18 @@
+--TEST--
+GtkInfoBar->set_default_response method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'set_default_response')) die('skip - \
GtkInfoBar->set_default_response not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->add_button("TestButton", 1);
+$ib->set_default_response(1);
+$ib->set_default_response();
+?>
+--EXPECTF--
+Warning: GtkInfoBar::set_default_response() requires exactly 1 argument, 0 given in \
                %s on line %d
diff --git a/tests/GtkInfoBar/set_message_type.phpt \
b/tests/GtkInfoBar/set_message_type.phpt new file mode 100644
index 0000000..009d04e
--- /dev/null
+++ b/tests/GtkInfoBar/set_message_type.phpt
@@ -0,0 +1,21 @@
+--TEST--
+GtkInfoBar->set_message_type method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'set_message_type')) die('skip - \
GtkInfoBar->set_message_type not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->set_message_type(Gtk::MESSAGE_INFO);
+var_dump($ib->get_message_type() == Gtk::MESSAGE_INFO);
+$ib->set_message_type();
+?>
+--EXPECTF--
+bool(true)
+
+Warning: GtkInfoBar::set_message_type() requires exactly 1 argument, 0 given in %s \
on line %d +
diff --git a/tests/GtkInfoBar/set_response_sensitive.phpt \
b/tests/GtkInfoBar/set_response_sensitive.phpt new file mode 100644
index 0000000..07d5c3f
--- /dev/null
+++ b/tests/GtkInfoBar/set_response_sensitive.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GtkInfoBar->set_response_sensitive method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkInfoBar', 'set_response_sensitive')) die('skip - \
GtkInfoBar->set_response_sensitive not available, requires GTK 2.18 or higher'); +?>
+--FILE--
+<?php
+$win = new GtkWindow();
+$ib = new GtkInfoBar();
+$win->add($ib);
+$ib->add_button("TestButton", 1);
+$win->show_all();
+
+$ib->set_response_sensitive(1, false);
+$ib->set_response_sensitive();
+?>
+--EXPECTF--
+Warning: GtkInfoBar::set_response_sensitive() requires exactly 2 arguments, 0 given \
in %s on line %d



-- 
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic