[Sie-announce] SIEコード [2292] SVG DOMに関するSpecを追加

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 1月 11日 (火) 23:18:37 JST


Revision: 2292
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2292
Author:   dhrname
Date:     2011-01-11 23:18:37 +0900 (Tue, 11 Jan 2011)

Log Message:
-----------
SVG DOMに関するSpecを追加

Added Paths:
-----------
    trunk/Spec/SvgDomSpec.js

Added: trunk/Spec/SvgDomSpec.js
===================================================================
--- trunk/Spec/SvgDomSpec.js	                        (rev 0)
+++ trunk/Spec/SvgDomSpec.js	2011-01-11 14:18:37 UTC (rev 2292)
@@ -0,0 +1,122 @@
+/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
+ *公式ページは http://sie.sourceforge.jp/
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla SVG Cairo Renderer project.
+ *
+ * The Initial Developer of the Original Code is IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Parts of this file contain code derived from the following files(s)
+ * of the Mozilla SVG project (these parts are Copyright (C) by their
+ * respective copyright-holders):
+ *    layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
+ *
+ * Contributor(s):DHRNAME revulo bellbind
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
+/*
+ *Copyright (c) 2008-2010 Pivotal Labs
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+describe("SVG Test", function() {
+  var doc, svg;
+  beforeEach(function() {
+    /*前もって実行しておく変数(The variable 'doc' is a document node, and the 'svg' is a root element node.)*/
+    doc = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg");
+    svg = doc.documentElement;
+  });
+  describe("SVG Unit :: SVG Length", function() {
+    var s;
+    beforeEach(function() {
+      s = svg.createSVGLength();
+    });
+    /*まずは、あるべきデフォルト値かどうかをチェックしていく(Checking the default value of a SVGLength interface.)*/
+    it("for the default value on the property of SVGLength", function() {
+      /*See http://www.w3.org/TR/SVG/struct.html#InterfaceSVGDocument
+       * *createSVGLength()
+       * *Creates an SVGLength object outside of any document trees. The object is initialized to the value of 0 user units. 
+       *see also http://www.w3.org/TR/SVG/types.html#InterfaceSVGLength
+       * *SVG_LENGTHTYPE_NUMBER (unsigned short)
+       * *No unit type was provided (i.e., a unitless value was specified), which indicates a value in user units.
+       */
+      expect(s.value).toEqual(0);
+      expect(s.valueInSpecifiedUnits).toEqual(0);
+      expect(s.unitType).toEqual(1);
+    });
+    /*境界条件を調べておく*/
+    it("should be this for the value, when it calls a newValueSpecifiedUnits method (in case of Number.MAX_VALUE)", function() {
+      s.newValueSpecifiedUnits(1, Number.MAX_VALUE);
+      expect(s.valueInSpecifiedUnits).toEqual(Number.MAX_VALUE);
+      expect(s.value).toEqual(Number.MAX_VALUE);
+      expect(s.valueAsString).toEqual(Number.MAX_VALUE+"");
+    });
+    it("should be this for the value, when it calls a newValueSpecifiedUnits method (in case of Number.MIN_VALUE)", function() {
+      s.newValueSpecifiedUnits(1, Number.MIN_VALUE);
+      expect(s.valueInSpecifiedUnits).toEqual(Number.MIN_VALUE);
+      expect(s.value).toEqual(Number.MIN_VALUE);
+      expect(s.valueAsString).toEqual(Number.MIN_VALUE+"");
+    });
+    it("should be this for the value, when it calls a newValueSpecifiedUnits method (in case of 0)", function() {
+      s.newValueSpecifiedUnits(1, 0);
+      expect(s.valueInSpecifiedUnits).toEqual(0);
+      expect(s.value).toEqual(0);
+      expect(s.valueAsString).toEqual("0");
+    });
+  });
+});
\ No newline at end of file




Sie-announce メーリングリストの案内
Back to archive index