// Path: library/src/main/java/com/google/android/material/motion/testing/SimulatedMotionSource.java
// public class SimulatedMotionSource<T> extends SimulatedSource<T, MotionObserver<T>> {
// 
//   @Override
//   protected IndefiniteObservable<MotionObserver<T>> createObservable(IndefiniteObservable.Connector<MotionObserver<T>> connector) {
//     return new MotionObservable<>(connector);
//   }
// 
//   @Override
//   public MotionObservable<T> getObservable() {
//     return (MotionObservable<T>) super.getObservable();
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/testing/TrackingMotionObserver.java
// public class TrackingMotionObserver<T> extends SimpleMotionObserver<T> {
// 
//   public final List<T> values = new ArrayList<>();
// 
//   @Override
//   public void next(T value) {
//     values.add(value);
//   }
// }


import static com.google.common.truth.Truth.assertThat;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.PointF;
import android.view.View;
import com.google.android.material.motion.testing.SimulatedMotionSource;
import com.google.android.material.motion.testing.TrackingMotionObserver;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
/*
 * Copyright 2016-present The Material Motion Authors. All Rights Reserved.
 *
 * 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.
 */
package com.google.android.material.motion;





@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class MotionRuntimeTests {

  private static final float E = 0.0001f;

  private MotionRuntime runtime;

  @Before
  public void setUp() {
    runtime = new MotionRuntime();
  }

  @Test
  public void writeAndReadCenterProperty() {
    View target = new View(Robolectric.setupActivity(Activity.class));
    runtime.get(target).center().write(new PointF(15, 40));
    assertThat(runtime.get(target).center().read()).isEqualTo(new PointF(15, 40));

    runtime.get(target).center().write(new PointF(1, 2));
    assertThat(runtime.get(target).center().read()).isEqualTo(new PointF(1, 2));
  }

  @Test
  public void readWriteSubscribeCenterProperty() {
    View target = new View(Robolectric.setupActivity(Activity.class));
    runtime.get(target).center().write(new PointF(1,2));

// Path: library/src/main/java/com/google/android/material/motion/testing/SimulatedMotionSource.java
// public class SimulatedMotionSource<T> extends SimulatedSource<T, MotionObserver<T>> {
// 
//   @Override
//   protected IndefiniteObservable<MotionObserver<T>> createObservable(IndefiniteObservable.Connector<MotionObserver<T>> connector) {
//     return new MotionObservable<>(connector);
//   }
// 
//   @Override
//   public MotionObservable<T> getObservable() {
//     return (MotionObservable<T>) super.getObservable();
//   }
// }
// 
// Path: library/src/main/java/com/google/android/material/motion/testing/TrackingMotionObserver.java
// public class TrackingMotionObserver<T> extends SimpleMotionObserver<T> {
// 
//   public final List<T> values = new ArrayList<>();
// 
//   @Override
//   public void next(T value) {
//     values.add(value);
//   }
// }


// Path: library/src/test/java/com/google/android/material/motion/MotionRuntimeTests.java
import static com.google.common.truth.Truth.assertThat;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.PointF;
import android.view.View;
import com.google.android.material.motion.testing.SimulatedMotionSource;
import com.google.android.material.motion.testing.TrackingMotionObserver;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

/*
 * Copyright 2016-present The Material Motion Authors. All Rights Reserved.
 *
 * 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.
 */
package com.google.android.material.motion;





@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class MotionRuntimeTests {

  private static final float E = 0.0001f;

  private MotionRuntime runtime;

  @Before
  public void setUp() {
    runtime = new MotionRuntime();
  }

  @Test
  public void writeAndReadCenterProperty() {
    View target = new View(Robolectric.setupActivity(Activity.class));
    runtime.get(target).center().write(new PointF(15, 40));
    assertThat(runtime.get(target).center().read()).isEqualTo(new PointF(15, 40));

    runtime.get(target).center().write(new PointF(1, 2));
    assertThat(runtime.get(target).center().read()).isEqualTo(new PointF(1, 2));
  }

  @Test
  public void readWriteSubscribeCenterProperty() {
    View target = new View(Robolectric.setupActivity(Activity.class));
    runtime.get(target).center().write(new PointF(1,2));

    TrackingMotionObserver<PointF> tracker = new TrackingMotionObserver<>();