From b3ceed048bb533a00bbea542f7c12b49c8c83d9b Mon Sep 17 00:00:00 2001
From: wei <>
Date: Sat, 17 Jun 2006 01:55:05 +0000
Subject: Update changes to active controls, add FT tests for active controls,
add comments.
---
tests/FunctionalTests/active-controls/index.php | 20 +++++++++
.../active-controls/protected/.htaccess | 1 +
.../active-controls/protected/application.xml | 11 +++++
.../protected/pages/ActiveButtonTest.page | 9 ++++
.../protected/pages/ActiveButtonTest.php | 16 ++++++++
.../protected/pages/ActivePanelTest.page | 22 ++++++++++
.../protected/pages/ActivePanelTest.php | 12 ++++++
.../protected/pages/ActiveTextBoxCallback.page | 5 +++
.../protected/pages/ActiveTextBoxCallback.php | 11 +++++
.../protected/pages/AutoCompleteTest.page | 48 ++++++++++++++++++++++
.../protected/pages/AutoCompleteTest.php | 34 +++++++++++++++
.../protected/pages/Calculator.page | 31 ++++++++++++++
.../active-controls/protected/pages/Calculator.php | 12 ++++++
.../protected/pages/CallbackOptionsTest.page | 34 +++++++++++++++
.../protected/pages/FeatureList.page | 3 ++
.../protected/pages/FeatureList.php | 34 +++++++++++++++
.../active-controls/protected/pages/Home.page | 1 +
.../protected/pages/NestedActiveControls.page | 28 +++++++++++++
.../protected/pages/NestedActiveControls.php | 19 +++++++++
.../active-controls/tests/ActiveButtonTestCase.php | 16 ++++++++
.../active-controls/tests/ActivePanelTestCase.php | 16 ++++++++
.../active-controls/tests/CalculatorTestCase.php | 24 +++++++++++
.../tests/CallbackOptionsTestCase.php | 34 +++++++++++++++
.../tests/NestedActiveControlsTestCase.php | 26 ++++++++++++
.../tests/TextBoxCallbackTestCase.php | 17 ++++++++
25 files changed, 484 insertions(+)
create mode 100644 tests/FunctionalTests/active-controls/index.php
create mode 100644 tests/FunctionalTests/active-controls/protected/.htaccess
create mode 100755 tests/FunctionalTests/active-controls/protected/application.xml
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/Calculator.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/Calculator.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page
create mode 100755 tests/FunctionalTests/active-controls/protected/pages/FeatureList.page
create mode 100755 tests/FunctionalTests/active-controls/protected/pages/FeatureList.php
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/Home.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page
create mode 100644 tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
create mode 100644 tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
create mode 100644 tests/FunctionalTests/active-controls/tests/ActivePanelTestCase.php
create mode 100644 tests/FunctionalTests/active-controls/tests/CalculatorTestCase.php
create mode 100644 tests/FunctionalTests/active-controls/tests/CallbackOptionsTestCase.php
create mode 100644 tests/FunctionalTests/active-controls/tests/NestedActiveControlsTestCase.php
create mode 100644 tests/FunctionalTests/active-controls/tests/TextBoxCallbackTestCase.php
(limited to 'tests/FunctionalTests/active-controls')
diff --git a/tests/FunctionalTests/active-controls/index.php b/tests/FunctionalTests/active-controls/index.php
new file mode 100644
index 00000000..8fa57a6a
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/index.php
@@ -0,0 +1,20 @@
+run();
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/.htaccess b/tests/FunctionalTests/active-controls/protected/.htaccess
new file mode 100644
index 00000000..3418e55a
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/application.xml b/tests/FunctionalTests/active-controls/protected/application.xml
new file mode 100755
index 00000000..03fe9bbb
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/application.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page
new file mode 100644
index 00000000..5c2d1abb
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.page
@@ -0,0 +1,9 @@
+
+ TActiveButton Functional Test
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php
new file mode 100644
index 00000000..6282b804
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveButtonTest.php
@@ -0,0 +1,16 @@
+label1->Text = "Button 1 was clicked ";
+ }
+
+ function button2_oncallback($sender, $param)
+ {
+ $this->label1->Text .= "using callback!";
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page
new file mode 100644
index 00000000..468a524e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.page
@@ -0,0 +1,22 @@
+
+ Active Panel replacement tests
+
+
+
+ Something lalala
+
+
+
+ Click Me!
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
new file mode 100644
index 00000000..79e3d46c
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActivePanelTest.php
@@ -0,0 +1,12 @@
+content1->visible = true;
+ $this->panel1->flush($param->output);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page
new file mode 100644
index 00000000..d0a750ac
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.page
@@ -0,0 +1,5 @@
+
+ ActiveTextBox Callback Test
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php
new file mode 100644
index 00000000..c3f729e5
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveTextBoxCallback.php
@@ -0,0 +1,11 @@
+label1->Text = 'Label 1: '.$sender->Text;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page
new file mode 100644
index 00000000..93658bd7
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.page
@@ -0,0 +1,48 @@
+
+
+
+
+ TAutoComplete Test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
new file mode 100644
index 00000000..938b8640
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php
@@ -0,0 +1,34 @@
+setDataSource($this->matchCountries($param->getParameter()));
+ $sender->dataBind();
+ $sender->render($param->getOutput());
+ }
+
+ protected function matchCountries($token)
+ {
+ $info = Prado::createComponent('System.I18N.core.CultureInfo', 'en');
+ $list = array();
+ $count = 0;
+ $token = strtolower($token);
+ foreach($info->getCountries() as $country)
+ {
+ if(strpos(strtolower($country), $token) === 0)
+ {
+ $list[] = $country;
+ $count++;
+ if($count > 10) break;
+ }
+ }
+ return $list;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Calculator.page b/tests/FunctionalTests/active-controls/protected/pages/Calculator.page
new file mode 100644
index 00000000..7a565658
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Calculator.page
@@ -0,0 +1,31 @@
+
+ Callback Enabled Calculator
+
+
+ +
+
+ =
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Calculator.php b/tests/FunctionalTests/active-controls/protected/pages/Calculator.php
new file mode 100644
index 00000000..098a8460
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Calculator.php
@@ -0,0 +1,12 @@
+c->Text = floatval($this->a->Text) + floatval($this->b->Text);
+ }
+}
+
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page
new file mode 100644
index 00000000..6e8b8a1e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CallbackOptionsTest.page
@@ -0,0 +1,34 @@
+
+ TCallbackOptions Test
+
+
+
+ $("status").show();
+
+
+ $("status").hide();
+
+
+ Element.update("label1", "Button 1 has returned");
+
+
+
+
+
+
+ Element.update("label2", "Button 2 has returned");
+
+
+
+
+ Element.update("label3", "Button 3 has returned");
+
+
+
+ Label 1
+ Label 2
+ Label 3
+
+ Loading...
+
+
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page
new file mode 100755
index 00000000..eab14a87
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.page
@@ -0,0 +1,3 @@
+
+
+
diff --git a/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php
new file mode 100755
index 00000000..8f28f6de
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/FeatureList.php
@@ -0,0 +1,34 @@
+getPageList(dirname(__FILE__),'');
+ $this->List->DataSource=$list;
+ $this->List->dataBind();
+ }
+
+ protected function getPageList($directory,$basePath)
+ {
+ $list=array();
+ $folder=@opendir($directory);
+ while($entry=@readdir($folder))
+ {
+ if($entry[0]==='.')
+ continue;
+ else if(is_file($directory.'/'.$entry))
+ {
+ if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false)
+ $list['?page='.$basePath.$page]=$basePath.$page;
+ }
+ else
+ $list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
+ }
+ closedir($folder);
+ return $list;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/Home.page b/tests/FunctionalTests/active-controls/protected/pages/Home.page
new file mode 100644
index 00000000..ff226d4e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/Home.page
@@ -0,0 +1 @@
+
Welcome to Prado!
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page
new file mode 100644
index 00000000..d8eacf15
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.page
@@ -0,0 +1,28 @@
+
+ Nested Active Controls Test
+
+
+
+ Something lalala
+
+
+
+
+
+
+
+ Click Me!
+
+
+
+
+
+
diff --git a/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
new file mode 100644
index 00000000..a4a22cbf
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/NestedActiveControls.php
@@ -0,0 +1,19 @@
+content1->visible = true;
+ $this->panel1->flush($param->output);
+ }
+
+ function button1_clicked($sender, $param)
+ {
+ $this->label1->Text = "Label 1: Button 1 Clicked";
+ $this->label2->Text = "Label 2: Button 1 Clicked";
+ $this->label3->Text = "Label 3: Button 1 Clicked";
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
new file mode 100644
index 00000000..0a294906
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveButtonTestCase.php
@@ -0,0 +1,16 @@
+open("active-controls/index.php?page=ActiveButtonTest");
+ $this->verifyTextPresent("TActiveButton Functional Test");
+ $this->assertText("label1", "Label 1");
+ $this->click("button2");
+ $this->pause(500);
+ $this->assertText("label1", "Button 1 was clicked using callback!");
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActivePanelTestCase.php b/tests/FunctionalTests/active-controls/tests/ActivePanelTestCase.php
new file mode 100644
index 00000000..a9fb6c4e
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActivePanelTestCase.php
@@ -0,0 +1,16 @@
+open("active-controls/index.php?page=ActivePanelTest");
+ $this->verifyTextPresent("Active Panel replacement tests");
+ $this->assertTextNotPresent('Something lalala');
+ $this->click("div1");
+ $this->pause(500);
+ $this->assertTextPresent("Something lalala");
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/CalculatorTestCase.php b/tests/FunctionalTests/active-controls/tests/CalculatorTestCase.php
new file mode 100644
index 00000000..2fb28224
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/CalculatorTestCase.php
@@ -0,0 +1,24 @@
+open("active-controls/index.php?page=Calculator");
+ $this->assertTextPresent("Callback Enabled Calculator");
+ $this->assertNotVisible("summary");
+
+ $this->click("sum");
+ $this->assertVisible("summary");
+
+ $this->type("a", "2");
+ $this->type("b", "5");
+
+ $this->click("sum");
+ $this->assertNotVisible("summary");
+
+ $this->assertValue("c", "7");
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/CallbackOptionsTestCase.php b/tests/FunctionalTests/active-controls/tests/CallbackOptionsTestCase.php
new file mode 100644
index 00000000..d72499cf
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/CallbackOptionsTestCase.php
@@ -0,0 +1,34 @@
+open("active-controls/index.php?page=CallbackOptionsTest");
+ $this->verifyTextPresent("TCallbackOptions Test");
+
+ $this->assertText("label1", "Label 1");
+ $this->assertText("label2", "Label 2");
+ $this->assertText("label3", "Label 3");
+
+ $this->click("button1");
+ $this->pause(500);
+ $this->assertText("label1", "Button 1 has returned");
+ $this->assertText("label2", "Label 2");
+ $this->assertText("label3", "Label 3");
+
+ $this->click("button2");
+ $this->pause(500);
+ $this->assertText("label1", "Button 1 has returned");
+ $this->assertText("label2", "Button 2 has returned");
+ $this->assertText("label3", "Label 3");
+
+ $this->click("button3");
+ $this->pause(500);
+ $this->assertText("label1", "Button 1 has returned");
+ $this->assertText("label2", "Button 2 has returned");
+ $this->assertText("label3", "Button 3 has returned");
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/NestedActiveControlsTestCase.php b/tests/FunctionalTests/active-controls/tests/NestedActiveControlsTestCase.php
new file mode 100644
index 00000000..8d0cfb87
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/NestedActiveControlsTestCase.php
@@ -0,0 +1,26 @@
+open("active-controls/index.php?page=NestedActiveControls");
+ $this->verifyTextPresent("Nested Active Controls Test");
+ $this->assertText("label1", "Label 1");
+ $this->assertText("label2", "Label 2");
+ $this->assertTextNotPresent("Label 3");
+
+ $this->click("div1");
+ $this->pause(500);
+ $this->assertTextPresent("Something lalala");
+ $this->assertText("label3", "Label 3");
+
+ $this->click("button1");
+ $this->pause(500);
+ $this->assertText("label1", "Label 1: Button 1 Clicked");
+ $this->assertText("label2", "Label 2: Button 1 Clicked");
+ $this->assertText("label3", "Label 3: Button 1 Clicked");
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/TextBoxCallbackTestCase.php b/tests/FunctionalTests/active-controls/tests/TextBoxCallbackTestCase.php
new file mode 100644
index 00000000..24cba49b
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/TextBoxCallbackTestCase.php
@@ -0,0 +1,17 @@
+open("active-controls/index.php?page=ActiveTextBoxCallback");
+ $this->verifyTextPresent("ActiveTextBox Callback Test");
+ $this->assertText("label1", "Label 1");
+
+ $this->type("textbox1", "hello!");
+ $this->pause(500);
+ $this->assertText("label1", "Label 1: hello!");
+ }
+}
+
+?>
\ No newline at end of file
--
cgit v1.2.3