diff options
| author | wei <> | 2007-03-30 12:06:27 +0000 | 
|---|---|---|
| committer | wei <> | 2007-03-30 12:06:27 +0000 | 
| commit | fbfbdcb233e94b7fed6f8ae209eb90d79aa33f7e (patch) | |
| tree | 4c684403050cf0633574547316ede7a4e56cb7bb | |
| parent | 63f771ad05eaf96c11053cb6e009f7b8633eb4fe (diff) | |
Add test case for #528
7 files changed, 140 insertions, 0 deletions
| diff --git a/.gitattributes b/.gitattributes index 8345a7ff..af43113d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2344,6 +2344,7 @@ tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php -text  tests/FunctionalTests/tickets.php -text  tests/FunctionalTests/tickets/index.php -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  tests/FunctionalTests/tickets/protected/pages/Layout.tpl -text  tests/FunctionalTests/tickets/protected/pages/TestHtmlArea.php -text @@ -2397,6 +2398,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket477.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket477.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket484.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket484.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket500.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket500.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket504.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket504.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket507.page -text @@ -2407,6 +2410,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket521.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket521.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket526.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket526.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket528.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket528.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket538.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket538.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket54.page -text @@ -2446,6 +2451,7 @@ tests/FunctionalTests/tickets/tests/Ticket504TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket507TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket521TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket526TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket528TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket538TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket54TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket573TestCase.php -text diff --git a/tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php b/tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php new file mode 100644 index 00000000..81fdfea7 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php @@ -0,0 +1,34 @@ +<?php
 +Prado::using('System.Web.UI.ActiveControls.*');
 +class DActiveDropDownList2 extends TActiveDropDownList
 +{
 +    public function setOpcoes($val)
 +    {
 +        $this->setViewState('Opcoes', $val);
 +    }
 +
 +    public function loadOptions()
 +    {
 +        $opcao =  $this->getViewState('Opcoes');
 +
 +        switch ($opcao) {
 +            case "turnos":
 +                $this->DataTextField="descricao";
 +                $this->DataValueField="id_turno";
 +                $opts = array(
 +                    array('id_turno' => 'M', 'descricao' => 'Manhã'),
 +                    array('id_turno' => 'T', 'descricao' => 'Tarde'),
 +                    array('id_turno' => 'N', 'descricao' => 'Noite')
 +                );
 +                break;
 +
 +            default:
 +                throw new TConfigurationException('Falta argumento OPCOES no DActiveDropDownList');
 +                break;
 +        }
 +        $this->setDataSource($opts);
 +        $this->dataBind();
 +    }
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket500.page b/tests/FunctionalTests/tickets/protected/pages/Ticket500.page new file mode 100644 index 00000000..a5ef32ca --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket500.page @@ -0,0 +1,7 @@ +<com:TContent ID="Content">
 +
 +<com:TActiveHyperLink ID="link1" Text="link 1"/>
 +
 +<com:TActiveButton ID="button1" Text="set url" onclick="set_url"/>
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket500.php b/tests/FunctionalTests/tickets/protected/pages/Ticket500.php new file mode 100644 index 00000000..fc7af222 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket500.php @@ -0,0 +1,13 @@ +<?php
 +
 +Prado::using('System.Web.UI.ActiveControls.*');
 +class Ticket500 extends TPage
 +{
 +	function set_url()
 +	{
 +		$url=$this->Service->constructUrl('Cats.Buy.Browse',array('filter' => 'basket'));
 +		$this->link1->NavigateUrl = $url;
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket528.page b/tests/FunctionalTests/tickets/protected/pages/Ticket528.page new file mode 100644 index 00000000..f3a85e2a --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket528.page @@ -0,0 +1,13 @@ +<com:TContent ID="Content">
 +
 +<com:TLabel ForControl="DDropTurno" Text="Turno:"/>
 +<com:Application.pages.DActiveDropDownList2 
 +	ID="DDropTurno" onSelectedIndexChanged="trocaTurno" opcoes='turnos' />
 +
 +<com:TLabel Text="Código:" ForControl="Codigo"/>
 +<com:TActiveTextBox ID="Codigo" MaxLength="1" Columns="2" />
 +
 +<com:TLabel Text="Descrição:" ForControl="Descricao"/>
 +<com:TActiveTextBox ID="Descricao" MaxLength="25" Columns="25" />
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket528.php b/tests/FunctionalTests/tickets/protected/pages/Ticket528.php new file mode 100644 index 00000000..c2d1fcbe --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket528.php @@ -0,0 +1,35 @@ +<?php
 +Prado::using('System.Web.UI.ActiveControls.*');
 +class Ticket528 extends TPage
 +{
 +	 public static $turnos = array(
 +                    'M' => array('id_turno' => 'M', 'descricao' => 'Manhã'),
 +                    'T' => array('id_turno' => 'T', 'descricao' => 'Tarde'),
 +                    'N' => array('id_turno' => 'N', 'descricao' => 'Noite')
 +                   );
 +
 +
 +    public function onLoad($param)
 +    {
 +        parent::onLoad($param);
 +        if (!$this->IsPostBack) {
 +            $this->DDropTurno->loadOptions();
 +            $this->loadDadosTurno($this->DDropTurno->getSelectedValue());
 +        }
 +    }
 +
 +
 +    protected function loadDadosTurno($id)
 +    {
 +        $this->Codigo->setText(self::$turnos[$id]['id_turno']);
 +        $this->Descricao->setText(self::$turnos[$id]['descricao']);
 +    }
 +
 +
 +    public function trocaTurno($sender,$param)
 +    {
 +        $this->loadDadosTurno($sender->getSelectedValue());
 +    }
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket528TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket528TestCase.php new file mode 100644 index 00000000..86b28378 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket528TestCase.php @@ -0,0 +1,32 @@ +<?php
 +
 +class Ticket528TestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$base = 'ctl0_Content_';
 +		$this->open('tickets/index.php?page=Ticket528');
 +		$this->assertTitle("Verifying Ticket 528");
 +
 +		$this->select("{$base}DDropTurno", "Tarde");
 +		$this->pause(800);
 +
 +		$this->assertValue("{$base}Codigo", "T");
 +		$this->assertValue("{$base}Descricao", "Tarde");
 +
 +		$this->select("{$base}DDropTurno", "Manhã");
 +		$this->pause(800);
 +
 +		$this->assertValue("{$base}Codigo", "M");
 +		$this->assertValue("{$base}Descricao", "Manhã");
 +
 +		$this->select("{$base}DDropTurno", "Noite");
 +		$this->pause(800);
 +
 +		$this->assertValue("{$base}Codigo", "N");
 +		$this->assertValue("{$base}Descricao", "Noite");
 +
 +	}
 +}
 +
 +?>
\ No newline at end of file | 
