forked from iSoron/uhabits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/refactoring-mvc' into dev
- Loading branch information
Showing
329 changed files
with
19,627 additions
and
10,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file removed
BIN
-8.48 KB
app/src/androidTest/assets/views/CheckmarkView/implicitly_checked.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-3.86 KB
app/src/androidTest/assets/views/NumberView/renderDifferentParams.png
Binary file not shown.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added
BIN
+551 Bytes
...roidTest/assets/views/habits/list/CheckmarkButtonView/render_explicit_check.png
Oops, something went wrong.
Binary file added
BIN
+505 Bytes
...roidTest/assets/views/habits/list/CheckmarkButtonView/render_implicit_check.png
Oops, something went wrong.
Binary file added
BIN
+559 Bytes
...c/androidTest/assets/views/habits/list/CheckmarkButtonView/render_unchecked.png
Oops, something went wrong.
Binary file added
BIN
+1.37 KB
app/src/androidTest/assets/views/habits/list/CheckmarkPanelView/render.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+8.48 KB
app/src/androidTest/assets/views/widgets/CheckmarkWidgetView/checked.png
Oops, something went wrong.
Binary file added
BIN
+9.42 KB
...src/androidTest/assets/views/widgets/CheckmarkWidgetView/implicitly_checked.png
Oops, something went wrong.
Binary file added
BIN
+16.6 KB
app/src/androidTest/assets/views/widgets/CheckmarkWidgetView/large_size.png
Oops, something went wrong.
Binary file added
BIN
+9.61 KB
app/src/androidTest/assets/views/widgets/CheckmarkWidgetView/unchecked.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
app/src/androidTest/java/org/isoron/uhabits/AndroidTestComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation, either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits; | ||
|
||
import javax.inject.Singleton; | ||
|
||
import dagger.Component; | ||
|
||
@Singleton | ||
@Component(modules = {AndroidModule.class}) | ||
public interface AndroidTestComponent extends BaseComponent | ||
{ | ||
void inject(BaseAndroidTest baseAndroidTest); | ||
} | ||
|
135 changes: 135 additions & 0 deletions
135
app/src/androidTest/java/org/isoron/uhabits/BaseAndroidTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation, either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits; | ||
|
||
import android.appwidget.*; | ||
import android.content.*; | ||
import android.os.*; | ||
import android.support.annotation.*; | ||
import android.support.test.*; | ||
|
||
import org.isoron.uhabits.commands.*; | ||
import org.isoron.uhabits.models.*; | ||
import org.isoron.uhabits.tasks.*; | ||
import org.isoron.uhabits.utils.*; | ||
import org.junit.*; | ||
|
||
import java.util.*; | ||
import java.util.concurrent.*; | ||
|
||
import javax.inject.*; | ||
|
||
import static junit.framework.Assert.*; | ||
import static org.hamcrest.MatcherAssert.*; | ||
import static org.hamcrest.Matchers.*; | ||
|
||
public class BaseAndroidTest | ||
{ | ||
// 8:00am, January 25th, 2015 (UTC) | ||
public static final long FIXED_LOCAL_TIME = 1422172800000L; | ||
|
||
private static boolean isLooperPrepared; | ||
|
||
protected Context testContext; | ||
|
||
protected Context targetContext; | ||
|
||
@Inject | ||
protected Preferences prefs; | ||
|
||
@Inject | ||
protected HabitList habitList; | ||
|
||
@Inject | ||
protected CommandRunner commandRunner; | ||
|
||
protected AndroidTestComponent androidTestComponent; | ||
|
||
protected HabitFixtures fixtures; | ||
|
||
protected CountDownLatch latch; | ||
|
||
@Before | ||
public void setUp() | ||
{ | ||
if (!isLooperPrepared) | ||
{ | ||
Looper.prepare(); | ||
isLooperPrepared = true; | ||
} | ||
|
||
targetContext = InstrumentationRegistry.getTargetContext(); | ||
testContext = InstrumentationRegistry.getContext(); | ||
|
||
InterfaceUtils.setFixedTheme(R.style.AppBaseTheme); | ||
DateUtils.setFixedLocalTime(FIXED_LOCAL_TIME); | ||
|
||
androidTestComponent = DaggerAndroidTestComponent.builder().build(); | ||
HabitsApplication.setComponent(androidTestComponent); | ||
androidTestComponent.inject(this); | ||
|
||
fixtures = new HabitFixtures(habitList); | ||
|
||
latch = new CountDownLatch(1); | ||
} | ||
|
||
protected void assertWidgetProviderIsInstalled(Class componentClass) | ||
{ | ||
ComponentName provider = | ||
new ComponentName(targetContext, componentClass); | ||
AppWidgetManager manager = AppWidgetManager.getInstance(targetContext); | ||
|
||
List<ComponentName> installedProviders = new LinkedList<>(); | ||
for (AppWidgetProviderInfo info : manager.getInstalledProviders()) | ||
installedProviders.add(info.provider); | ||
|
||
assertThat(installedProviders, hasItems(provider)); | ||
} | ||
|
||
protected void setTheme(@StyleRes int themeId) | ||
{ | ||
InterfaceUtils.setFixedTheme(themeId); | ||
targetContext.setTheme(themeId); | ||
} | ||
|
||
protected void sleep(int time) | ||
{ | ||
try | ||
{ | ||
Thread.sleep(time); | ||
} | ||
catch (InterruptedException e) | ||
{ | ||
fail(); | ||
} | ||
} | ||
|
||
protected void waitForAsyncTasks() | ||
throws InterruptedException, TimeoutException | ||
{ | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) | ||
{ | ||
Thread.sleep(1000); | ||
return; | ||
} | ||
|
||
BaseTask.waitForTasks(10000); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.