mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
@@ -95,7 +95,7 @@ open class AndroidBugReporter @Inject constructor(@AppContext private val contex
|
||||
appendln("App Version Name: ${BuildConfig.VERSION_NAME}")
|
||||
appendln("App Version Code: ${BuildConfig.VERSION_CODE}")
|
||||
appendln("OS Version: ${System.getProperty("os.version")} (${Build.VERSION.INCREMENTAL})")
|
||||
appendln("OS API Level: ${Build.VERSION.SDK}")
|
||||
appendln("OS API Level: ${Build.VERSION.SDK_INT}")
|
||||
appendln("Device: ${Build.DEVICE}")
|
||||
appendln("Model (Product): ${Build.MODEL} (${Build.PRODUCT})")
|
||||
appendln("Manufacturer: ${Build.MANUFACTURER}")
|
||||
|
||||
@@ -18,12 +18,9 @@
|
||||
*/
|
||||
package org.isoron.androidbase
|
||||
|
||||
import java.lang.annotation.Documented
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
import javax.inject.Qualifier
|
||||
|
||||
@Qualifier
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@MustBeDocumented
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class AppContext
|
||||
@@ -31,9 +31,8 @@ import org.isoron.uhabits.core.ui.screens.habits.list.*;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static androidx.test.InstrumentationRegistry.getContext;
|
||||
import static androidx.test.InstrumentationRegistry.getTargetContext;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.core.app.ApplicationProvider.*;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.*;
|
||||
import static androidx.test.uiautomator.UiDevice.*;
|
||||
|
||||
public class BaseUserInterfaceTest
|
||||
@@ -59,18 +58,18 @@ public class BaseUserInterfaceTest
|
||||
intent.setComponent(new ComponentName(PKG, cls.getCanonicalName()));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getContext().startActivity(intent);
|
||||
getApplicationContext().startActivity(intent);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
device = getInstance(getInstrumentation());
|
||||
TestButler.setup(getTargetContext());
|
||||
TestButler.verifyAnimationsDisabled(getTargetContext());
|
||||
TestButler.setup(getApplicationContext());
|
||||
TestButler.verifyAnimationsDisabled(getApplicationContext());
|
||||
|
||||
HabitsApplication app =
|
||||
(HabitsApplication) getTargetContext().getApplicationContext();
|
||||
(HabitsApplication) getApplicationContext().getApplicationContext();
|
||||
component = app.getComponent();
|
||||
habitList = component.getHabitList();
|
||||
prefs = component.getPreferences();
|
||||
@@ -83,7 +82,7 @@ public class BaseUserInterfaceTest
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
for (int i = 0; i < 10; i++) device.pressBack();
|
||||
TestButler.teardown(getTargetContext());
|
||||
TestButler.teardown(getApplicationContext());
|
||||
}
|
||||
|
||||
private void resetState() throws Exception
|
||||
|
||||
@@ -19,16 +19,15 @@
|
||||
|
||||
package org.isoron.uhabits.acceptance.steps;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.*;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.annotation.*;
|
||||
import androidx.recyclerview.widget.*;
|
||||
import androidx.test.espresso.*;
|
||||
import androidx.test.espresso.contrib.*;
|
||||
import androidx.test.uiautomator.*;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.*;
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.activities.habits.list.*;
|
||||
@@ -39,8 +38,8 @@ import static androidx.test.espresso.action.ViewActions.*;
|
||||
import static androidx.test.espresso.assertion.PositionAssertions.*;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.*;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.*;
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class CommonSteps extends BaseUserInterfaceTest
|
||||
{
|
||||
@@ -125,7 +124,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
||||
verifyDisplaysText(text[0]);
|
||||
for(int i = 1; i < text.length; i++) {
|
||||
verifyDisplaysText(text[i]);
|
||||
onView(withText(text[i])).check(isBelow(withText(text[i-1])));
|
||||
onView(withText(text[i])).check(isCompletelyBelow(withText(text[i-1])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.isoron.uhabits.acceptance.steps;
|
||||
import androidx.test.uiautomator.*;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.isoron.uhabits.BaseUserInterfaceTest.*;
|
||||
|
||||
public class WidgetSteps {
|
||||
|
||||
@@ -20,14 +20,13 @@
|
||||
package org.isoron.uhabits.activities.common.views;
|
||||
|
||||
import android.os.*;
|
||||
import androidx.core.os.*;
|
||||
import androidx.customview.view.AbsSavedState;
|
||||
|
||||
import androidx.customview.view.*;
|
||||
|
||||
public class BundleSavedState extends AbsSavedState
|
||||
{
|
||||
public static final Parcelable.Creator<BundleSavedState> CREATOR =
|
||||
ParcelableCompat.newCreator(
|
||||
new ParcelableCompatCreatorCallbacks<BundleSavedState>()
|
||||
new ClassLoaderCreator<BundleSavedState>()
|
||||
{
|
||||
@Override
|
||||
public BundleSavedState createFromParcel(Parcel source,
|
||||
@@ -36,12 +35,18 @@ public class BundleSavedState extends AbsSavedState
|
||||
return new BundleSavedState(source, loader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleSavedState createFromParcel(Parcel source)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleSavedState[] newArray(int size)
|
||||
{
|
||||
return new BundleSavedState[size];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
public final Bundle bundle;
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ import android.util.*;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.*;
|
||||
|
||||
import org.isoron.androidbase.utils.*;
|
||||
import org.isoron.uhabits.*;
|
||||
@@ -109,7 +108,7 @@ public abstract class HabitWidgetView extends FrameLayout
|
||||
backgroundPaint.setAlpha(backgroundAlpha);
|
||||
|
||||
frame = (ViewGroup) findViewById(R.id.frame);
|
||||
if (frame != null) frame.setBackgroundDrawable(background);
|
||||
if (frame != null) frame.setBackground(background);
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.junit.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class ArchiveHabitsCommandTest extends BaseUnitTest
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.isoron.uhabits.core.*;
|
||||
import org.isoron.uhabits.core.models.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ import org.isoron.uhabits.core.models.*;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.isoron.uhabits.core.models.Checkmark.CHECKED_EXPLICITLY;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.isoron.uhabits.core.models.Checkmark.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class CreateRepetitionCommandTest extends BaseUnitTest
|
||||
{
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.isoron.uhabits.core.models.*;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ToggleRepetitionCommandTest extends BaseUnitTest
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ package org.isoron.uhabits.core.models;
|
||||
import org.isoron.uhabits.core.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.IsEqual.*;
|
||||
|
||||
public class WeekdayListTest extends BaseUnitTest
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
|
||||
package org.isoron.uhabits.core.ui.screens.habits.list;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.isoron.uhabits.core.*;
|
||||
import org.isoron.uhabits.core.commands.*;
|
||||
import org.isoron.uhabits.core.models.*;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -100,7 +98,7 @@ public class HabitCardListCacheTest extends BaseUnitTest
|
||||
assertThat(cache.getHabitCount(), equalTo(10));
|
||||
|
||||
Habit h = habitList.getByPosition(3);
|
||||
junit.framework.Assert.assertNotNull(h.getId());
|
||||
Assert.assertNotNull(h.getId());
|
||||
double score = h.getScores().getTodayValue();
|
||||
|
||||
assertThat(cache.getHabitByPosition(3), equalTo(h));
|
||||
|
||||
Reference in New Issue
Block a user