From 8a38b5643655c82a843c4e429cbc3fafdff198ce Mon Sep 17 00:00:00 2001
From: tof <>
Date: Thu, 28 Jun 2007 08:41:57 +0000
Subject: Add functional test case for Ticket659
---
.gitattributes | 5 +++
.../protected/controls/ToggleImageButton.php | 45 +++++++++++++++++++++
.../tickets/protected/controls/down.gif | Bin 0 -> 1308 bytes
.../tickets/protected/controls/up.gif | Bin 0 -> 499 bytes
.../protected/pages/ExtendedToggleImageButton.php | 17 ++++++++
.../tickets/protected/pages/Ticket659.page | 4 ++
.../tickets/protected/pages/Ticket659.php | 19 +++++++++
.../tickets/protected/pages/ToggleTest.page | 4 ++
.../tickets/protected/pages/ToggleTest.php | 19 +++++++++
.../tickets/tests/Ticket659TestCase.php | 23 +++++++++++
10 files changed, 136 insertions(+)
create mode 100644 tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php
create mode 100644 tests/FunctionalTests/tickets/protected/controls/down.gif
create mode 100644 tests/FunctionalTests/tickets/protected/controls/up.gif
create mode 100644 tests/FunctionalTests/tickets/protected/pages/ExtendedToggleImageButton.php
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket659.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket659.php
create mode 100644 tests/FunctionalTests/tickets/protected/pages/ToggleTest.page
create mode 100644 tests/FunctionalTests/tickets/protected/pages/ToggleTest.php
create mode 100644 tests/FunctionalTests/tickets/tests/Ticket659TestCase.php
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 @@
+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
Binary files /dev/null and b/tests/FunctionalTests/tickets/protected/controls/down.gif 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
Binary files /dev/null and b/tests/FunctionalTests/tickets/protected/controls/up.gif 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 @@
+
\ 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 @@
+
+
+
+
\ 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 @@
+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 @@
+
+
+
+
\ 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 @@
+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 @@
+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
--
cgit v1.2.3