|
| 1 | +package com.iterable.iterableapi; |
| 2 | + |
| 3 | +import android.app.Application; |
| 4 | +import android.graphics.Rect; |
| 5 | +import android.test.ApplicationTestCase; |
| 6 | +import android.view.Gravity; |
| 7 | + |
| 8 | +/** |
| 9 | + * Tests |
| 10 | + * Created by David Truong [email protected]. |
| 11 | + */ |
| 12 | +public class IterableInAppTest extends ApplicationTestCase<Application> { |
| 13 | + public IterableInAppTest() { |
| 14 | + super(Application.class); |
| 15 | + } |
| 16 | + |
| 17 | + IterableInAppHTMLNotification notification; |
| 18 | + |
| 19 | + public void setUp() throws Exception { |
| 20 | + super.setUp(); |
| 21 | + |
| 22 | + notification = IterableInAppHTMLNotification.createInstance(getContext().getApplicationContext(), ""); |
| 23 | + } |
| 24 | + |
| 25 | + public void testGetLocationFull() { |
| 26 | + Rect padding = new Rect(0,0,0,0); |
| 27 | + int verticalLocation = notification.getVerticalLocation(padding); |
| 28 | + assertEquals(Gravity.CENTER_VERTICAL, verticalLocation); |
| 29 | + } |
| 30 | + |
| 31 | + public void testGetLocationTop() { |
| 32 | + Rect padding = new Rect(0,0,0,-1); |
| 33 | + int verticalLocation = notification.getVerticalLocation(padding); |
| 34 | + assertEquals(Gravity.TOP, verticalLocation); |
| 35 | + } |
| 36 | + |
| 37 | + public void testGetLocationBottom() throws Exception { |
| 38 | + Rect padding = new Rect(0,-1,0,0); |
| 39 | + int verticalLocation = notification.getVerticalLocation(padding); |
| 40 | + assertEquals(Gravity.BOTTOM, verticalLocation); |
| 41 | + } |
| 42 | + |
| 43 | + public void testGetLocationCenter() { |
| 44 | + Rect padding = new Rect(0,-1,0,-1); |
| 45 | + int verticalLocation = notification.getVerticalLocation(padding); |
| 46 | + assertEquals(Gravity.CENTER_VERTICAL, verticalLocation); |
| 47 | + } |
| 48 | + |
| 49 | + public void testGetLocationRandom() { |
| 50 | + Rect padding = new Rect(0,20,0,30); |
| 51 | + int verticalLocation = notification.getVerticalLocation(padding); |
| 52 | + assertEquals(Gravity.CENTER_VERTICAL, verticalLocation); |
| 53 | + } |
| 54 | +} |
0 commit comments