Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: sky/tests/styles/transforms.sky

Issue 958463002: Cleanup transform-related methods in RenderLayer. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: improve test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/rendering/RenderView.cpp ('k') | sky/tests/styles/transforms-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <style>
2 .container {
3 height: 100px;
4 width: 200px;
5 margin: 30px;
6 outline: 1px solid black;
7 }
8 .box {
9 height: 100%;
10 width: 100%;
11 padding: 5px;
12 margin: 5px;
13 border: 5px solid gray;
14 background-color: green;
15 transform-origin: 20% 50%;
16 }
17 </style>
18
19 <div class="container">
20 <div id="test-box" class="box"></div>
21 </div>
22
23 <script type="text/javascript" charset="utf-8">
24 import "../resources/third_party/unittest/unittest.dart";
25 import "../resources/unit.dart";
26
27 import "dart:sky";
28
29 void main() {
30 initUnit();
31
32 var testBox = document.getElementById('test-box');
33
34 void testTransformRoundTrip(transform, resultMatrix) {
35 testBox.style['transform'] = transform;
36 var computedTransform = window.getComputedStyle(testBox)['transform'];
37 expect(computedTransform, equals(resultMatrix));
38 }
39
40 test('pixel translate should roundtrip', () {
41 testTransformRoundTrip('translate(80px, 90px)', 'matrix(1, 0, 0, 1, 80, 90 )');
42 });
43
44 test('percent translate should roundtrip', () {
45 testTransformRoundTrip('translate(10px, 50%)', 'matrix(1, 0, 0, 1, 10, 60) ');
46 });
47
48 test('scale should roundtrip', () {
49 testTransformRoundTrip('scale(1.2, 0.8)', 'matrix(1.2, 0, 0, 0.8, 0, 0)');
50 });
51 }
52 </script>
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderView.cpp ('k') | sky/tests/styles/transforms-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698