summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortof <>2007-06-28 08:41:57 +0000
committertof <>2007-06-28 08:41:57 +0000
commit8a38b5643655c82a843c4e429cbc3fafdff198ce (patch)
treee26c044c2fb5910730f325a68f26dc5abba6eaa6
parent353b3d04ce7a03c7c87f7343e766b3f45e96003c (diff)
Add functional test case for Ticket659
-rw-r--r--.gitattributes5
-rw-r--r--tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php45
-rw-r--r--tests/FunctionalTests/tickets/protected/controls/down.gifbin0 -> 1308 bytes
-rw-r--r--tests/FunctionalTests/tickets/protected/controls/up.gifbin0 -> 499 bytes
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/ExtendedToggleImageButton.php17
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket659.page4
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket659.php19
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/ToggleTest.page4
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/ToggleTest.php19
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket659TestCase.php23
10 files changed, 136 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index e7d123b6..046b2814 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2468,6 +2468,8 @@ tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php -text
tests/FunctionalTests/tickets.php -text
tests/FunctionalTests/tickets/index.php -text
tests/FunctionalTests/tickets/protected/application.xml -text
+tests/FunctionalTests/tickets/protected/controls/down.gif -text
+tests/FunctionalTests/tickets/protected/controls/up.gif -text
tests/FunctionalTests/tickets/protected/messages/en/messages.xml -text
tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php -text
tests/FunctionalTests/tickets/protected/pages/Layout.php -text
@@ -2576,11 +2578,13 @@ tests/FunctionalTests/tickets/protected/pages/Ticket614.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket617.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket653/Layout.tpl -text
tests/FunctionalTests/tickets/protected/pages/Ticket653/ticket653.page -text
+tests/FunctionalTests/tickets/protected/pages/Ticket659.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket68.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket72.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket72.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket93.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket93.php -text
+tests/FunctionalTests/tickets/protected/pages/ToggleTest.page -text
tests/FunctionalTests/tickets/protected/pages/config.xml -text
tests/FunctionalTests/tickets/protected/pages/hotspot.jpg -text
tests/FunctionalTests/tickets/tests/Ticket121TestCase.php -text
@@ -2616,6 +2620,7 @@ tests/FunctionalTests/tickets/tests/Ticket585TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket586TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket587TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket653TestCase.php -text
+tests/FunctionalTests/tickets/tests/Ticket659TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket93TestCase.php -text
tests/FunctionalTests/validators.php -text
diff --git a/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
new file mode 100644
index 00000000..80c16ce5
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ *
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
+ * @copyright Copyright &copy; 2007, CERAM Sophia Antipolis
+ * @license url nameoflicense
+ * @version $Id$
+ *
+ */
+
+class ToggleImageButton extends TImageButton {
+
+ public function getState () {
+ return $this->getViewState('state', ToggleImageButtonState::Down);
+ }
+
+ public function setState($value) {
+ $this->setViewState('state', TPropertyValue::ensureEnum($value, ToggleImageButtonState));
+ }
+
+ public function toggleState () {
+ $this->setState(($this->getState()===ToggleImageButtonState::Down)?ToggleImageButtonState::Up:ToggleImageButtonState::Down);
+ }
+
+ public function onClick ($param) {
+ $this->toggleState();
+ parent::onClick($param);
+ }
+
+ public function getImageUrl () {
+ $img=($this->getState()===ToggleImageButtonState::Down)?'down.gif':'up.gif';
+ return $this->publishAsset($img);
+ }
+
+ public function setImageUrl() {
+ throw new TUnsupportedOperationException('ImageUrl property is read-only');
+ }
+}
+
+class ToggleImageButtonState extends TEnumerable {
+ const Down='Down';
+ const Up='Up';
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/controls/down.gif b/tests/FunctionalTests/tickets/protected/controls/down.gif
new file mode 100644
index 00000000..9f755b5d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/controls/down.gif
Binary files differ
diff --git a/tests/FunctionalTests/tickets/protected/controls/up.gif b/tests/FunctionalTests/tickets/protected/controls/up.gif
new file mode 100644
index 00000000..7eeb4896
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/controls/up.gif
Binary files differ
diff --git a/tests/FunctionalTests/tickets/protected/pages/ExtendedToggleImageButton.php b/tests/FunctionalTests/tickets/protected/pages/ExtendedToggleImageButton.php
new file mode 100644
index 00000000..2d0b709e
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/ExtendedToggleImageButton.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ *
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
+ * @copyright Copyright &copy; 2007, CERAM Sophia Antipolis
+ * @license url nameoflicense
+ * @version $Id$
+ *
+ */
+
+prado::using ('Application.controls.ToggleImageButton');
+
+class ExtendedToggleImageButton extends ToggleImageButton {
+
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket659.page b/tests/FunctionalTests/tickets/protected/pages/Ticket659.page
new file mode 100644
index 00000000..66b05eda
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket659.page
@@ -0,0 +1,4 @@
+<com:TContent ID="Content">
+<com:ExtendedToggleImageButton id="btn" OnClick="clickToggleButton" State="Down"/>
+<com:TLabel id="lbl" Text="Down"/>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket659.php b/tests/FunctionalTests/tickets/protected/pages/Ticket659.php
new file mode 100644
index 00000000..d294a831
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket659.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ *
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
+ * @copyright Copyright &copy; 2007, CERAM Sophia Antipolis
+ * @license url nameoflicense
+ * @version $Id$
+ *
+ */
+
+prado::using ('Application.pages.ExtendedToggleImageButton');
+
+class Ticket659 extends TPage {
+ public function clickToggleButton ($sender, $param) {
+ $this->lbl->Text=$sender->State;
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/ToggleTest.page b/tests/FunctionalTests/tickets/protected/pages/ToggleTest.page
new file mode 100644
index 00000000..0d633657
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/ToggleTest.page
@@ -0,0 +1,4 @@
+<com:TContent ID="Content">
+<com:ToggleImageButton id="btn" OnClick="clickToggleButton" State="Down"/>
+<com:TLabel id="lbl" Text="Down"/>
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/ToggleTest.php b/tests/FunctionalTests/tickets/protected/pages/ToggleTest.php
new file mode 100644
index 00000000..2c12cb72
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/ToggleTest.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ *
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
+ * @copyright Copyright &copy; 2007, CERAM Sophia Antipolis
+ * @license url nameoflicense
+ * @version $Id$
+ *
+ */
+
+prado::using ('Application.controls.ToggleImageButton');
+
+class ToggleTest extends TPage {
+ public function clickToggleButton ($sender, $param) {
+ $this->lbl->Text=$sender->State;
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket659TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket659TestCase.php
new file mode 100644
index 00000000..70c52f35
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket659TestCase.php
@@ -0,0 +1,23 @@
+<?php
+
+class Ticket659TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ // Normal component (working)
+ $this->open('tickets/index.php?page=ToggleTest');
+ $this->assertText("${base}lbl", "Down");
+ $this->click("${base}btn", "");
+ $this->pause(800);
+ $this->assertText("${base}lbl", "Up");
+ // Extended component (not working)
+ $this->open('tickets/index.php?page=Ticket659');
+ $this->assertText("${base}lbl", "Down");
+ $this->click("${base}btn", "");
+ $this->pause(800);
+ $this->assertText("${base}lbl", "Up");
+ }
+}
+
+?> \ No newline at end of file