Search in sources :

Example 41 with UiThreadTest

use of androidx.test.annotation.UiThreadTest in project realm-java by realm.

the class OrderedRealmCollectionIteratorTests method useCase_simpleIterator_modifyQueryResult_innerTransaction_looperThread.

@Test
@UiThreadTest
public void useCase_simpleIterator_modifyQueryResult_innerTransaction_looperThread() {
    if (skipTest(CollectionClass.MANAGED_REALMLIST, CollectionClass.UNMANAGED_REALMLIST, CollectionClass.REALMRESULTS)) {
        return;
    }
    assertEquals(TEST_SIZE, collection.size());
    for (int i = 0; i < collection.size(); i++) {
        realm.beginTransaction();
        AllJavaTypes obj = collection.get(i);
        obj.setFieldLong(obj.getFieldLong() + TEST_SIZE);
        realm.commitTransaction();
    }
    // Verifies that all elements were modified.
    assertEquals(0, realm.where(AllJavaTypes.class).lessThan(AllJavaTypes.FIELD_LONG, TEST_SIZE).count());
}
Also used : AllJavaTypes(io.realm.entities.AllJavaTypes) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 42 with UiThreadTest

use of androidx.test.annotation.UiThreadTest in project realm-java by realm.

the class OrderedRealmCollectionIteratorTests method useCase_forEachIterator_modifyQueryResult_innerTransaction_looperThread.

@Test
@UiThreadTest
public void useCase_forEachIterator_modifyQueryResult_innerTransaction_looperThread() {
    if (skipTest(CollectionClass.MANAGED_REALMLIST, CollectionClass.UNMANAGED_REALMLIST)) {
        return;
    }
    assertEquals(TEST_SIZE, collection.size());
    for (AllJavaTypes obj : collection) {
        realm.beginTransaction();
        obj.setFieldLong(obj.getFieldLong() + TEST_SIZE);
        realm.commitTransaction();
    }
    // Verifies that all elements were modified.
    assertEquals(0, realm.where(AllJavaTypes.class).lessThan(AllJavaTypes.FIELD_LONG, TEST_SIZE).count());
}
Also used : AllJavaTypes(io.realm.entities.AllJavaTypes) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 43 with UiThreadTest

use of androidx.test.annotation.UiThreadTest in project realm-java by realm.

the class OrderedRealmCollectionIteratorTests method useCase_forEachIterator_modifyQueryResult_outerTransaction_looperThread.

@Test
@UiThreadTest
public void useCase_forEachIterator_modifyQueryResult_outerTransaction_looperThread() {
    if (skipTest(CollectionClass.MANAGED_REALMLIST, CollectionClass.UNMANAGED_REALMLIST)) {
        return;
    }
    assertEquals(TEST_SIZE, collection.size());
    realm.beginTransaction();
    for (AllJavaTypes obj : collection) {
        obj.setFieldLong(obj.getFieldLong() + TEST_SIZE);
    }
    realm.commitTransaction();
    // Verifies that all elements were modified.
    assertEquals(0, realm.where(AllJavaTypes.class).lessThan(AllJavaTypes.FIELD_LONG, TEST_SIZE).count());
}
Also used : AllJavaTypes(io.realm.entities.AllJavaTypes) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 44 with UiThreadTest

use of androidx.test.annotation.UiThreadTest in project iterable-android-sdk by Iterable.

the class IterableInAppTest method testGetLocationRandom.

@Test
@UiThreadTest
public void testGetLocationRandom() {
    Rect padding = new Rect(0, 20, 0, 30);
    int verticalLocation = notification.getVerticalLocation(padding);
    assertEquals(Gravity.CENTER_VERTICAL, verticalLocation);
}
Also used : Rect(android.graphics.Rect) MediumTest(androidx.test.filters.MediumTest) UiThreadTest(androidx.test.annotation.UiThreadTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 45 with UiThreadTest

use of androidx.test.annotation.UiThreadTest in project iterable-android-sdk by Iterable.

the class IterableInAppTest method testGetLocationTop.

@Test
@UiThreadTest
public void testGetLocationTop() {
    Rect padding = new Rect(0, 0, 0, -1);
    int verticalLocation = notification.getVerticalLocation(padding);
    assertEquals(Gravity.TOP, verticalLocation);
}
Also used : Rect(android.graphics.Rect) MediumTest(androidx.test.filters.MediumTest) UiThreadTest(androidx.test.annotation.UiThreadTest) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest)

Aggregations

UiThreadTest (androidx.test.annotation.UiThreadTest)136 Test (org.junit.Test)129 View (android.view.View)41 Unbinder (butterknife.Unbinder)31 Context (android.content.Context)23 AdapterView (android.widget.AdapterView)18 TextView (android.widget.TextView)15 RecordingObserver (com.jakewharton.rxbinding4.RecordingObserver)15 MediumTest (androidx.test.filters.MediumTest)14 Intent (android.content.Intent)10 SubscriptionInfo (android.telephony.SubscriptionInfo)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 LocalPSMP (de.danoeh.antennapod.core.service.playback.LocalPSMP)9 PlaybackServiceMediaPlayer (de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer)9 Slice (androidx.slice.Slice)8 Playable (de.danoeh.antennapod.model.playback.Playable)8 AssertionFailedError (junit.framework.AssertionFailedError)8 Before (org.junit.Before)7 ViewGroup (android.view.ViewGroup)6 FrameLayout (android.widget.FrameLayout)6