<!--
 Copyright 2017 Google Inc.
 
 Licensed 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.
-->

<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.target {
  position: relative;
  width: 100px;
  height: 100px;
  background-color: black;
  display: inline-block;
  margin: 20px 0px 20px 0px;
  object-fit: fill;
}
.replica {
  background-color: green;
}
</style>
<body>
<script src="../testharness/testharness.js"></script>
<script src="../testharness/testharnessreport.js"></script>
<script src="resources/interpolation-test.js"></script>
<script>

assertInterpolation({
  property: 'object-position',
  from: '50% 50%',
  to: '100% 100%'
}, [
  {at: -0.3, is: '35% 35%'},
  {at: 0, is: '50% 50%'},
  {at: 0.5, is: '75% 75%'},
  {at: 1, is: '100% 100%'},
  {at: 1.5, is: '125% 125%'}
]);

assertInterpolation({
  property: 'object-position',
  from: '100px 200px',
  to: '0px 0px'
}, [
  {at: -0.3, is: '130px 260px'},
  {at: 0, is: '100px 200px'},
  {at: 0.5, is: '50px 100px'},
  {at: 1, is: '0px 0px'},
  {at: 1.5, is: '-50px -100px'}
]);

// Zero seem to be a special case in the old implementation
assertInterpolation({
  property: 'object-position',
  from: '50% 100%',
  to: '0px 0px'
}, [
  {at: -0.3, is: '65% 130%'},
  {at: 0, is: '50% 100%'},
  {at: 0.5, is: '25% 50%'},
  {at: 1, is: '0px 0px'},
  {at: 1.5, is: '-25% -50%'}
]);

assertInterpolation({
  property: 'object-position',
  from: '50% 100%',
  to: '50px 100px'
}, [
  {at: -0.3, is: 'calc(65% + -15px) calc(130% + -30px)'},
  {at: 0, is: '50% 100%'},
  {at: 0.5, is: 'calc(25% + 25px) calc(50% + 50px)'},
  {at: 1, is: '50px 100px'},
  {at: 1.5, is: 'calc(-25% + 75px) calc(-50% + 150px)'}
]);

assertInterpolation({
  property: 'object-position',
  from: 'center',
  to: 'top right'
}, [
  {at: -0.3, is: '35% 65%'},
  {at: 0, is: '50% 50%'},
  {at: 0.5, is: '75% 25%'},
  {at: 1, is: '100% 0%'},
  {at: 1.5, is: '125% -25%'}
]);
</script>
</body>
