Author: psharples
Date: Thu Feb 2 14:09:08 2012
New Revision: 1239627
URL: http://svn.apache.org/viewvc?rev=1239627&view=rev
Log:
Moving test widgets to the scratchpad area.
Added:
incubator/wookie/trunk/scratchpad/widgets/localetest/
incubator/wookie/trunk/scratchpad/widgets/localetest/Images/
incubator/wookie/trunk/scratchpad/widgets/localetest/Images/test.png
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml (with
props)
incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml (with
props)
incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm (with
props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/Images/
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/Images/test.png
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm
(with props)
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm
(with props)
incubator/wookie/trunk/scratchpad/widgets/test/
incubator/wookie/trunk/scratchpad/widgets/test/build.xml (with props)
incubator/wookie/trunk/scratchpad/widgets/test/config.xml (with props)
incubator/wookie/trunk/scratchpad/widgets/test/icon.png (with props)
incubator/wookie/trunk/scratchpad/widgets/test/index.htm (with props)
incubator/wookie/trunk/scratchpad/widgets/test/styles.css (with props)
incubator/wookie/trunk/scratchpad/widgets/test/test.js (with props)
Removed:
incubator/wookie/trunk/widgets/localetest/
incubator/wookie/trunk/widgets/test/
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/Images/test.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/Images/test.png?rev=1239627&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/scratchpad/widgets/localetest/Images/test.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml (added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml Thu Feb 2
14:09:08 2012
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project default="build-widget" basedir="." name="widget build file">
+ <property name="wookie.widgets.dir" location="../"/>
+ <property name="widget.shortname" value="localetest"/>
+
+ <import file="../build.xml"/>
+</project>
\ No newline at end of file
Propchange: incubator/wookie/trunk/scratchpad/widgets/localetest/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml (added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml Thu Feb 2
14:09:08 2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets"
id="http://www.getwookie.org/widgets/localetest" height="383" width="255">
+ <name>locale test</name>
+ <name xml:lang="fr">tester les paramètres régionaux</name>
+ <description>widget for testing localization</description>
+ <description xml:lang="fr">widget pour les tests de
localisation</description>
+ <icon src="icon.png"/>
+ <author href="http://incubator.apache.org/wookie"
email="[email protected]">Apache Wookie (incubating) Team</author>
+ <license
href="http://www.apache.org/licenses/LICENSE-2.0.html">Licensed under the
Apache 2.0 License</license>
+</widget>
\ No newline at end of file
Propchange: incubator/wookie/trunk/scratchpad/widgets/localetest/config.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm (added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm Thu Feb 2
14:09:08 2012
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Hello World! (default, not localized version)</p>
+
+<p><img src="Images/test.png"/></p>
\ No newline at end of file
Propchange: incubator/wookie/trunk/scratchpad/widgets/localetest/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm?rev=1239627&view=auto
==============================================================================
---
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm
(added)
+++
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm
Thu Feb 2 14:09:08 2012
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Ayup World!</p>
+
+<p><img src="Images/test.png"/></p>
\ No newline at end of file
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en-gb-yorks/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm
(added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm
Thu Feb 2 14:09:08 2012
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Hello World!</p>
+
+<p><img src="Images/test.png"/></p>
\ No newline at end of file
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt
(added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt
Thu Feb 2 14:09:08 2012
@@ -0,0 +1 @@
+test
\ No newline at end of file
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/en/test.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/Images/test.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/Images/test.png?rev=1239627&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/Images/test.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm
(added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm
Thu Feb 2 14:09:08 2012
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Bonjour tout le Monde!</p>
+
+<p><img src="Images/test.png"/></p>
\ No newline at end of file
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/fr/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm
(added)
+++ incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm Thu
Feb 2 14:09:08 2012
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<p>Hello World! (non-localized)</p>
+
+<p><img src="Images/test.png"/></p>
\ No newline at end of file
Propchange:
incubator/wookie/trunk/scratchpad/widgets/localetest/locales/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/test/build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/build.xml?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/test/build.xml (added)
+++ incubator/wookie/trunk/scratchpad/widgets/test/build.xml Thu Feb 2
14:09:08 2012
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project default="build-widget" basedir="." name="widget build file">
+ <property name="wookie.widgets.dir" location="../"/>
+ <property name="widget.shortname" value="test"/>
+
+ <import file="../build.xml"/>
+</project>
\ No newline at end of file
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/test/config.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/config.xml?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/test/config.xml (added)
+++ incubator/wookie/trunk/scratchpad/widgets/test/config.xml Thu Feb 2
14:09:08 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<widget xmlns="http://www.w3.org/ns/widgets"
+ id="http://www.getwookie.org/widgets/test"
+ version="1.0" height="520" width="320">
+ <name>API Test</name>
+ <description>A W3C API Testing Widget</description>
+ <icon src="icon.png"/>
+ <content src="index.htm"/>
+ <author href="http://www.cetis.ac.uk/members/scott"
+ email="[email protected]">Scott Wilson</author>
+ <license>Licensed under the Apache 2.0 License (see
http://www.apache.org/licenses/LICENSE-2.0).</license>
+ <preference name="default_one" value="1" readonly="true"/>
+ <preference name="default_two" value="2"/>
+</widget>
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/config.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/test/icon.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/icon.png?rev=1239627&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/icon.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/scratchpad/widgets/test/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/index.htm?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/test/index.htm (added)
+++ incubator/wookie/trunk/scratchpad/widgets/test/index.htm Thu Feb 2
14:09:08 2012
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+ <head>
+ <link rel="stylesheet" href="styles.css" type="text/css" />
+ <script type="text/javascript" src="test.js"></script>
+ </head>
+ <body onload="test_cases()">
+ <p><a href="http://dev.w3.org/2006/waf/widgets-api/">W3C Widgets
API</a> Tester</p>
+ <table id = "tests" name = "tests">
+ <tbody>
+ <tr>
+ <td>Test</td>
+ <td>Result</td>
+ </tr>
+ </tbody>
+ </table>
+ </body>
+</html>
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/index.htm
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/test/styles.css
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/styles.css?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/test/styles.css (added)
+++ incubator/wookie/trunk/scratchpad/widgets/test/styles.css Thu Feb 2
14:09:08 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+html{
+ font-family: "trebuchet ms", tahoma, verana, arial, sans-serif;
+}
+
+td {
+ font-size: 7pt;
+}
+
+.pass {
+ background-color: #CFC;
+}
+
+.fail {
+ background-color: red;
+}
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/styles.css
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/wookie/trunk/scratchpad/widgets/test/test.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/test/test.js?rev=1239627&view=auto
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/test/test.js (added)
+++ incubator/wookie/trunk/scratchpad/widgets/test/test.js Thu Feb 2 14:09:08
2012
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var attributeTest = [];
+attributeTest['id'] = "http://www.getwookie.org/widgets/test";
+attributeTest['author'] = "Scott Wilson";
+attributeTest['authorEmail'] = "[email protected]";
+attributeTest['authorHref'] = "http://www.cetis.ac.uk/members/scott";
+attributeTest['name'] = "API Test";
+attributeTest['description'] = "A W3C API Testing Widget";
+attributeTest['version'] = "1.0";
+attributeTest['width'] = "320";
+attributeTest['height'] = "520";
+
+function test_cases(){
+ testAttributes();
+ testPreferences();
+}
+
+function testAttributes(){
+ var idx = 1
+ for (t in attributeTest){
+ var testid = "TA"+idx;
+ var testname = "access attribute:"+t;
+ var expected = attributeTest[t];
+ var test = new Function("return widget."+t);
+ testFunction(testid,test, testname,expected);
+ idx ++;
+ }
+}
+
+function testPreferences(){
+ // test a non-existing preference
+ testPreferenceValue("TP1", "preferences.getitem(Non-existing
preference)","non-existing","null");
+ // set a value
+ widget.preferences.setItem("newPref","new value");
+ testPreferenceValue("TP2", "preferences: setItem/getItem","newPref","new
value");
+ // test preference defaults
+ testPreferenceValue("TP3", "preferences: defaults","default_one","1");
+ testPreferenceValue("TP4", "preferences: defaults[2]","default_two","2");
+ // set and remove a value
+ //widget.preferences.setItem("testremove","testremove");
+ //widget.preferences.removeItem("testremove");
+ //testPreferenceValue("TP5", "preferences: remove","testremove","null");
+ // access using "nice" api
+ widget.preferences.setItem("nice", "smashing");
+ testNicePreferenceValue("TP6","preferences: set new pref, get with
'widget.preferences.nice'","nice", "smashing");
+ testNicePreferenceValue("TP7", "preferences: get default pref with
'widget.preferences.default_one'","default_one","1");
+ // read-only access
+ addTestRow("TP8","preferences: set read only default pref with
'widget.preferences.default_one=7'");
+ try{
+ widget.preferences.default_one = 7;
+ fail("TP8");
+ } catch(e){
+ printValue("TP8", e);
+ pass("TP8");
+ }
+ addTestRow("TP9","preferences: set read only default pref with setItem()");
+ try{
+ widget.preferences.setItem("default_one", 7);
+ fail("TP9");
+ } catch(e){
+ printValue("TP9", e);
+ pass("TP9");
+ }
+}
+
+function testPreferenceValue(testid, testname, pref, expected){
+ testFunction(testid, new Function("return
widget.preferences.getItem('"+pref+"')"), testname, expected);
+}
+
+function testNicePreferenceValue(testid, testname, pref, expected){
+ testFunction(testid, new Function("return widget.preferences."+pref),
testname, expected);
+}
+
+////////////
+
+function testFunction(testid, test, testname, expected){
+ addTestRow(testid,testname);
+ var value = test();
+ if (!value || value === null || value == '') value = 'null';
+ printValue(testid, value);
+ if (value == expected){
+ pass(testid);
+ } else {
+ fail(testid);
+ }
+}
+
+
+function printValue(testid, value){
+ var elem = document.getElementById(testid+"Value");
+ elem.innerHTML = value;
+}
+
+function addTestRow(testid, testname){
+ var tableElem = document.getElementById("tests");
+ var tableBody = tableElem.tBodies[0];
+ var newRow = tableBody.insertRow(-1);
+ var testCell = newRow.insertCell(0);
+ testCell.innerHTML = testname;
+ testCell.id = testid;
+ var resultCell = newRow.insertCell(1);
+ resultCell.id = testid+"Value";
+}
+
+function pass(pref){
+ var elem = document.getElementById(pref+"Value");
+ //elem.innerHTML = "PASSED";
+ elem.className = "pass";
+}
+
+function fail(pref){
+ var elem = document.getElementById(pref+"Value");
+ //elem.innerHTML = "FAILED";
+ elem.className = "fail";
+}
Propchange: incubator/wookie/trunk/scratchpad/widgets/test/test.js
------------------------------------------------------------------------------
svn:mime-type = text/plain