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 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php (limited to 'tests/FunctionalTests/tickets/protected/controls/ToggleImageButton.php') 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 -- cgit v1.2.3