1 package org.robolectric.shadows; 2 3 import static com.google.common.truth.Truth.assertThat; 4 5 import android.hardware.Camera; 6 import androidx.test.ext.junit.runners.AndroidJUnit4; 7 import org.junit.Before; 8 import org.junit.Test; 9 import org.junit.runner.RunWith; 10 import org.robolectric.shadow.api.Shadow; 11 12 @RunWith(AndroidJUnit4.class) 13 public class ShadowCameraSizeTest { 14 15 private Camera.Size cameraSize; 16 17 @Before 18 public void setUp() throws Exception { 19 cameraSize = Shadow.newInstanceOf(Camera.class).new Size(480, 320); 20 } 21 22 @Test 23 public void testConstructor() throws Exception { 24 assertThat(cameraSize.width).isEqualTo(480); 25 assertThat(cameraSize.height).isEqualTo(320); 26 } 27 28 @Test 29 public void testSetWidth() throws Exception { 30 assertThat(cameraSize.width).isNotEqualTo(640); 31 cameraSize.width = 640; 32 assertThat(cameraSize.width).isEqualTo(640); 33 } 34 35 @Test 36 public void testSetHeight() throws Exception { 37 assertThat(cameraSize.height).isNotEqualTo(480); 38 cameraSize.height = 480; 39 assertThat(cameraSize.height).isEqualTo(480); 40 } 41 42 } 43