summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/test_bug435293-scale.html
blob: 91777af3c7b6069e83e6ae61ea18742fcee7b4bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=435293
-->
<head>
  <title>Test for Bug 435293</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

  <style>
    .test {
      background: green;
      height: 100px;
      width: 100px;
    }
    #test1 {
      -moz-transform: scalex(0.5);
    }
    #test2 {
      -moz-transform: scaley(0.5);
    }
    #test3 {
      -moz-transform: scale(0.5, 0.5);
    }
    #test4 {
      -moz-transform: scale(0.5, 0.5, 0.5);
    }
    #test5 {
      -moz-transform: scale(80%, none);
    }
    #test6 {
      -moz-transform: scale(640000, 0.0000000000000000001);
    }
    #test7 {
      -moz-transform: scale(2em, 4px);
    }
  </style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435293">Mozilla Bug 435293</a>
<p id="display"></p>
<div id="content">
  <div id="test1" class="test">
    test
  </div>
  <p id="test2" class="test">
    test
  </p>
  <div id="test3" class="test">
    test
  </div>
  <div id="test4" class="test">
    test
  </div>
  <div id="test5" class="test">
    test
  </div>
  <div id="test6" class="test">
    test
  </div>
  <div id="test7" class="test">
    test
  </div>
</div>

<pre id="test">
<script type="application/javascript">
runtests();

function runtests() {
  var style = window.getComputedStyle(document.getElementById("test1"), "");
  is(style.getPropertyValue("-moz-transform"), "matrix(0.5, 0, 0, 1, 0, 0)",
     "Scalex proper matrix is applied");

  style = window.getComputedStyle(document.getElementById("test2"), "");
  is(style.getPropertyValue("-moz-transform"), "matrix(1, 0, 0, 0.5, 0, 0)",
     "Scaley proper matrix is applied");

  style = window.getComputedStyle(document.getElementById("test3"), "");
  is(style.getPropertyValue("-moz-transform"), "matrix(0.5, 0, 0, 0.5, 0, 0)",
     "Scale proper matrix is applied");

  style = window.getComputedStyle(document.getElementById("test4"), "");
  is(style.getPropertyValue("-moz-transform"), "none",
     "Three dimensional scale should be ignored");

  style = window.getComputedStyle(document.getElementById("test5"), "");
  is(style.getPropertyValue("-moz-transform"), "none",
     "Percent values in scale should be ignored");

  style = window.getComputedStyle(document.getElementById("test6"), "");
  is(style.getPropertyValue("-moz-transform"), "matrix(640000, 0, 0, 1e-19, 0, 0)",
     "Ensure wacky values are accepted");

  style = window.getComputedStyle(document.getElementById("test7"), "");
  is(style.getPropertyValue("-moz-transform"), "none",
     "No unit values allowed in scale");
}
</script>
</pre>
</body>
</html>