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 --- .../protected/controls/ToggleImageButton.php | 45 +++++++++++++++++++++ .../tickets/protected/controls/down.gif | Bin 0 -> 1308 bytes .../tickets/protected/controls/up.gif | Bin 0 -> 499 bytes 3 files changed, 45 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 (limited to 'tests/FunctionalTests/tickets/protected/controls') 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 -- cgit v1.2.3