mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-08 10:08:51 -06:00
Implement acceptance tests for some basic features
This commit is contained in:
@@ -85,8 +85,8 @@ public class HabitsApplication extends Application
|
||||
|
||||
if (isTestMode())
|
||||
{
|
||||
File db = DatabaseUtils.getDatabaseFile(context);
|
||||
if (db.exists()) db.delete();
|
||||
// File db = DatabaseUtils.getDatabaseFile(context);
|
||||
// if (db.exists()) db.delete();
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -23,11 +23,13 @@ import android.support.annotation.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.isoron.androidbase.activities.*;
|
||||
import org.isoron.uhabits.intents.*;
|
||||
import org.isoron.uhabits.core.ui.screens.about.*;
|
||||
import org.isoron.uhabits.intents.*;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
import static org.isoron.uhabits.core.ui.screens.about.AboutBehavior.Message.*;
|
||||
|
||||
public class AboutScreen extends BaseScreen implements AboutBehavior.Screen
|
||||
{
|
||||
@NonNull
|
||||
@@ -44,7 +46,9 @@ public class AboutScreen extends BaseScreen implements AboutBehavior.Screen
|
||||
@Override
|
||||
public void showMessage(AboutBehavior.Message message)
|
||||
{
|
||||
Toast.makeText(activity, "OK", Toast.LENGTH_LONG).show();
|
||||
if (message == YOU_ARE_NOW_A_DEVELOPER) Toast
|
||||
.makeText(activity, "You are now a developer", Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,6 +80,13 @@ public class AndroidPreferences
|
||||
}
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
if(!HabitsApplication.isTestMode()) throw new IllegalStateException(
|
||||
"this method can only be used while testing");
|
||||
prefs.edit().clear().commit();
|
||||
}
|
||||
|
||||
public void setDefaultOrder(HabitList.Order order)
|
||||
{
|
||||
prefs.edit().putString("pref_default_order", order.name()).apply();
|
||||
|
||||
Reference in New Issue
Block a user