dom/smil/test/db_smilCSSPaced.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set shiftwidth=4 tabstop=4 autoindent cindent noexpandtab: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /* testcase data for paced-mode animations of CSS properties */
     9 // Lists of testcases for re-use across multiple properties of the same type
    10 var _pacedTestLists =
    11 {
    12   color: [
    13     new AnimTestcasePaced("rgb(2,  4,  6); " +
    14                           "rgb(4,  8, 12); " +
    15                           "rgb(8, 16, 24)",
    16                           { comp0: "rgb(2, 4, 6)",
    17                             comp1_6: "rgb(3, 6, 9)",
    18                             comp1_3: "rgb(4, 8, 12)",
    19                             comp2_3: "rgb(6, 12, 18)",
    20                             comp1:   "rgb(8, 16, 24)"
    21                           }),
    22     new AnimTestcasePaced("rgb(10, 10, 10); " +
    23                           "rgb(20, 10, 8); " +
    24                           "rgb(20, 30, 4)",
    25                           { comp0:   "rgb(10, 10, 10)",
    26                             comp1_6: "rgb(15, 10, 9)",
    27                             comp1_3: "rgb(20, 10, 8)",
    28                             comp2_3: "rgb(20, 20, 6)",
    29                             comp1:   "rgb(20, 30, 4)"
    30                           }),
    31     new AnimTestcasePaced("olive; " +        // rgb(128, 128, 0)
    32                           "currentColor; " + // rgb(50, 50, 50)
    33                           "rgb(206, 150, 206)",
    34                           { comp0:   "rgb(128, 128, 0)",
    35                             comp1_6: "rgb(89, 89, 25)",
    36                             comp1_3: "rgb(50, 50, 50)",
    37                             comp2_3: "rgb(128, 100, 128)",
    38                             comp1:   "rgb(206, 150, 206)"
    39                           }),
    40   ],
    41   paintServer : [
    42     // Sanity check: These aren't interpolatable -- they should end up
    43     // ignoring the calcMode="paced" and falling into discrete-mode.
    44     new AnimTestcasePaced("url(#gradA); url(#gradB)",
    45           {
    46             comp0:   "url(\"" + document.URL + "#gradA\") rgb(0, 0, 0)",
    47             comp1_6: "url(\"" + document.URL + "#gradA\") rgb(0, 0, 0)",
    48             comp1_3: "url(\"" + document.URL + "#gradA\") rgb(0, 0, 0)",
    49             comp2_3: "url(\"" + document.URL + "#gradB\") rgb(0, 0, 0)",
    50             comp1:   "url(\"" + document.URL + "#gradB\") rgb(0, 0, 0)"
    51           },
    52           "need support for URI-based paints"),
    53     new AnimTestcasePaced("url(#gradA); url(#gradB); url(#gradC)",
    54           {
    55             comp0:   "url(\"" + document.URL + "#gradA\") rgb(0, 0, 0)",
    56             comp1_6: "url(\"" + document.URL + "#gradA\") rgb(0, 0, 0)",
    57             comp1_3: "url(\"" + document.URL + "#gradB\") rgb(0, 0, 0)",
    58             comp2_3: "url(\"" + document.URL + "#gradC\") rgb(0, 0, 0)",
    59             comp1:   "url(\"" + document.URL + "#gradC\") rgb(0, 0, 0)"
    60           },
    61           "need support for URI-based paints"),
    62   ],
    63   lengthNoUnits : [
    64     new AnimTestcasePaced("2; 0; 4",
    65                           { comp0:   "2px",
    66                             comp1_6: "1px",
    67                             comp1_3: "0px",
    68                             comp2_3: "2px",
    69                             comp1:   "4px"
    70                           }),
    71     new AnimTestcasePaced("10; 12; 8",
    72                           { comp0:   "10px",
    73                             comp1_6: "11px",
    74                             comp1_3: "12px",
    75                             comp2_3: "10px",
    76                             comp1:    "8px"
    77                           }),
    78   ],
    79   lengthNoUnitsSVG : [
    80     new AnimTestcasePaced("2; 0; 4",
    81                           { comp0:   "2",
    82                             comp1_6: "1",
    83                             comp1_3: "0",
    84                             comp2_3: "2",
    85                             comp1:   "4"
    86                           }),
    87     new AnimTestcasePaced("10; 12; 8",
    88                           { comp0:   "10",
    89                             comp1_6: "11",
    90                             comp1_3: "12",
    91                             comp2_3: "10",
    92                             comp1:   "8"
    93                           }),
    94   ],
    95   lengthPx : [
    96     new AnimTestcasePaced("0px; 2px; 6px",
    97                           { comp0:   "0px",
    98                             comp1_6: "1px",
    99                             comp1_3: "2px",
   100                             comp2_3: "4px",
   101                             comp1:   "6px"
   102                           }),
   103   ],
   104   lengthPx : [
   105     new AnimTestcasePaced("0px; 2px; 6px",
   106                           { comp0:   "0px",
   107                             comp1_6: "1px",
   108                             comp1_3: "2px",
   109                             comp2_3: "4px",
   110                             comp1:   "6px"
   111                           }),
   112     new AnimTestcasePaced("10px; 12px; 8px",
   113                           { comp0:   "10px",
   114                             comp1_6: "11px",
   115                             comp1_3: "12px",
   116                             comp2_3: "10px",
   117                             comp1:   "8px"
   118                           }),
   119   ],
   120   lengthPctSVG : [
   121     new AnimTestcasePaced("5%; 6%; 4%",
   122                           { comp0:   "5%",
   123                             comp1_6: "5.5%",
   124                             comp1_3: "6%",
   125                             comp2_3: "5%",
   126                             comp1:   "4%"
   127                           }),
   128   ],
   129   lengthPxPctSVG : [
   130     new AnimTestcasePaced("0px; 1%; 6px",
   131                           { comp0:   "0px",
   132                             comp1_6: "1px",
   133                             comp1_3: "1%",
   134                             comp2_3: "4px",
   135                             comp1:   "6px"
   136                           },
   137                           "need support for interpolating between " +
   138                           "px and percent values"),
   139   ],
   140   opacity : [
   141     new AnimTestcasePaced("0; 0.2; 0.6",
   142                           { comp0:   "0",
   143                             comp1_6: "0.1",
   144                             comp1_3: "0.2",
   145                             comp2_3: "0.4",
   146                             comp1:   "0.6"
   147                           }),
   148     new AnimTestcasePaced("0.7; 1.0; 0.4",
   149                           { comp0:   "0.7",
   150                             comp1_6: "0.85",
   151                             comp1_3: "1",
   152                             comp2_3: "0.7",
   153                             comp1:   "0.4"
   154                           }),
   155   ],
   156   rect : [
   157     new AnimTestcasePaced("rect(2px, 4px, 6px, 8px); " +
   158                           "rect(4px, 8px, 12px, 16px); " +
   159                           "rect(8px, 16px, 24px, 32px)",
   160                           { comp0:   "rect(2px, 4px, 6px, 8px)",
   161                             comp1_6: "rect(3px, 6px, 9px, 12px)",
   162                             comp1_3: "rect(4px, 8px, 12px, 16px)",
   163                             comp2_3: "rect(6px, 12px, 18px, 24px)",
   164                             comp1:   "rect(8px, 16px, 24px, 32px)"
   165                           }),
   166     new AnimTestcasePaced("rect(10px, 10px, 10px, 10px); " +
   167                           "rect(20px, 10px, 50px, 8px); " +
   168                           "rect(20px, 30px, 130px, 4px)",
   169                           { comp0:   "rect(10px, 10px, 10px, 10px)",
   170                             comp1_6: "rect(15px, 10px, 30px, 9px)",
   171                             comp1_3: "rect(20px, 10px, 50px, 8px)",
   172                             comp2_3: "rect(20px, 20px, 90px, 6px)",
   173                             comp1:   "rect(20px, 30px, 130px, 4px)"
   174                           }),
   175     new AnimTestcasePaced("rect(10px, auto, 10px, 10px); " +
   176                           "rect(20px, auto, 50px, 8px); " +
   177                           "rect(40px, auto, 130px, 4px)",
   178                           { comp0:   "rect(10px, auto, 10px, 10px)",
   179                             comp1_6: "rect(15px, auto, 30px, 9px)",
   180                             comp1_3: "rect(20px, auto, 50px, 8px)",
   181                             comp2_3: "rect(30px, auto, 90px, 6px)",
   182                             comp1:   "rect(40px, auto, 130px, 4px)"
   183                           }),
   184     // Paced-mode animation is not supported in these next few cases
   185     // (Can't compute subcomponent distance between 'auto' & px-values)
   186     new AnimTestcasePaced("rect(10px, 10px, 10px, auto); " +
   187                           "rect(20px, 10px, 50px, 8px); " +
   188                           "rect(20px, 30px, 130px, 4px)",
   189                           { comp0:   "rect(10px, 10px, 10px, auto)",
   190                             comp1_6: "rect(10px, 10px, 10px, auto)",
   191                             comp1_3: "rect(20px, 10px, 50px, 8px)",
   192                             comp2_3: "rect(20px, 30px, 130px, 4px)",
   193                             comp1:   "rect(20px, 30px, 130px, 4px)"
   194                           }),
   195     new AnimTestcasePaced("rect(10px, 10px, 10px, 10px); " +
   196                           "rect(20px, 10px, 50px, 8px); " +
   197                           "auto",
   198                           { comp0:   "rect(10px, 10px, 10px, 10px)",
   199                             comp1_6: "rect(10px, 10px, 10px, 10px)",
   200                             comp1_3: "rect(20px, 10px, 50px, 8px)",
   201                             comp2_3: "auto",
   202                             comp1:   "auto"
   203                           }),
   204     new AnimTestcasePaced("auto; " +
   205                           "auto; " +
   206                           "rect(20px, 30px, 130px, 4px)",
   207                           { comp0:   "auto",
   208                             comp1_6: "auto",
   209                             comp1_3: "auto",
   210                             comp2_3: "rect(20px, 30px, 130px, 4px)",
   211                             comp1:   "rect(20px, 30px, 130px, 4px)"
   212                           }),
   213     new AnimTestcasePaced("auto; auto; auto",
   214                           { comp0:   "auto",
   215                             comp1_6: "auto",
   216                             comp1_3: "auto",
   217                             comp2_3: "auto",
   218                             comp1:   "auto"
   219                           }),
   220   ],
   221 };
   223 // TODO: test more properties here.
   224 var gPacedBundles =
   225 [
   226   new TestcaseBundle(gPropList.clip,  _pacedTestLists.rect),
   227   new TestcaseBundle(gPropList.color, _pacedTestLists.color),
   228   new TestcaseBundle(gPropList.direction, [
   229     new AnimTestcasePaced("rtl; ltr; rtl")
   230   ]),
   231   new TestcaseBundle(gPropList.fill,
   232                      [].concat(_pacedTestLists.color,
   233                                _pacedTestLists.paintServer)),
   234   new TestcaseBundle(gPropList.font_size,
   235                      [].concat(_pacedTestLists.lengthNoUnits,
   236                                _pacedTestLists.lengthPx, [
   237     new AnimTestcasePaced("20%; 24%; 16%",
   238                           { comp0:   "10px",
   239                             comp1_6: "11px",
   240                             comp1_3: "12px",
   241                             comp2_3: "10px",
   242                             comp1:   "8px"
   243                           }),
   244     new AnimTestcasePaced("0px; 4%; 6px",
   245                           { comp0:   "0px",
   246                             comp1_6: "1px",
   247                             comp1_3: "2px",
   248                             comp2_3: "4px",
   249                             comp1:   "6px"
   250                           }),
   251     ])
   252   ),
   253   new TestcaseBundle(gPropList.font_size_adjust, [
   254     new AnimTestcasePaced("0.2; 0.6; 0.8",
   255                           { comp0:   "0.2",
   256                             comp1_6: "0.3",
   257                             comp1_3: "0.4",
   258                             comp2_3: "0.6",
   259                             comp1:   "0.8"
   260                           }),
   261     new AnimTestcasePaced("none; none; 0.5",
   262                           { comp0:   "none",
   263                             comp1_6: "none",
   264                             comp1_3: "none",
   265                             comp2_3: "0.5",
   266                             comp1:   "0.5"
   267                           }),
   268   ]),
   269   new TestcaseBundle(gPropList.font_family, [
   270     // Sanity check: 'font-family' isn't interpolatable.  It should end up
   271     // ignoring the calcMode="paced" and falling into discrete-mode.
   272     new AnimTestcasePaced("serif; sans-serif; monospace",
   273                           { comp0:   "serif",
   274                             comp1_6: "serif",
   275                             comp1_3: "sans-serif",
   276                             comp2_3: "monospace",
   277                             comp1:   "monospace"
   278                           },
   279                           "need support for more font properties"),
   280   ]),
   281   new TestcaseBundle(gPropList.opacity, _pacedTestLists.opacity),
   282   new TestcaseBundle(gPropList.stroke_dasharray,
   283                      [].concat(_pacedTestLists.lengthPctSVG, [
   284     new AnimTestcasePaced("7, 7, 7; 7, 10, 3; 1, 2, 3",
   285                           { comp0:   "7, 7, 7",
   286                             comp1_6: "7, 8.5, 5",
   287                             comp1_3: "7, 10, 3",
   288                             comp2_3: "4, 6, 3",
   289                             comp1:   "1, 2, 3"
   290                           }),
   291   ])),
   292   new TestcaseBundle(gPropList.stroke_dashoffset,
   293                      [].concat(_pacedTestLists.lengthNoUnitsSVG,
   294                                _pacedTestLists.lengthPx,
   295                                _pacedTestLists.lengthPctSVG,
   296                                _pacedTestLists.lengthPxPctSVG)),
   297   new TestcaseBundle(gPropList.stroke_width,
   298                      [].concat(_pacedTestLists.lengthNoUnitsSVG,
   299                                _pacedTestLists.lengthPx,
   300                                _pacedTestLists.lengthPctSVG,
   301                                _pacedTestLists.lengthPxPctSVG)),
   302   // XXXdholbert TODO: test 'stroke-dasharray' once we support animating it
   303 ];

mercurial