Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public class MyListFragmentTest {
@Before
public void setUp() {
myListFragment = new MyListFragment_();
startFragment(myListFragment);
}

@Test
public void isItemClickAvailableFromListFragment() {
startFragment(myListFragment);
ListView listView = (ListView) myListFragment.findViewById(android.R.id.list);
long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX);
View view = listView.getChildAt(TESTED_CLICKED_INDEX);
Expand All @@ -65,20 +65,23 @@ public void isItemClickAvailableFromListFragment() {

@Test
public void notIgnoredMethodIsCalled() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.notIgnored();
assertTrue(myListFragment.didExecute);
}

@Test
public void uithreadMethodIsCalled() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.uiThread();
assertTrue(myListFragment.didExecute);
}

@Test
public void uithreadMethodIsCanceled() {
startFragment(myListFragment);
ShadowLooper.pauseMainLooper();
myListFragment.uiThreadWithId();
UiThreadExecutor.cancelAll("id");
Expand All @@ -88,6 +91,7 @@ public void uithreadMethodIsCanceled() {

@Test
public void backgroundMethodIsCalled() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
runBackgroundsOnSameThread();
myListFragment.backgroundThread();
Expand All @@ -96,6 +100,7 @@ public void backgroundMethodIsCalled() {

@Test
public void ignoredWhenDetachedWorksForUithreadMethod() {
startFragment(myListFragment);
popBackStack();

assertFalse(myListFragment.didExecute);
Expand All @@ -105,6 +110,7 @@ public void ignoredWhenDetachedWorksForUithreadMethod() {

@Test
public void ignoredWhenDetachedWorksForBackgroundMethod() {
startFragment(myListFragment);
popBackStack();

assertFalse(myListFragment.didExecute);
Expand All @@ -115,15 +121,24 @@ public void ignoredWhenDetachedWorksForBackgroundMethod() {

@Test
public void ignoredWhenDetachedWorksForIgnoredMethod() {
startFragment(myListFragment);
popBackStack();

assertFalse(myListFragment.didExecute);
myListFragment.ignored();
assertFalse(myListFragment.didExecute);
}

@Test
public void ignoredBeforeOnCreateView() {
assertFalse(myListFragment.didExecute);
myListFragment.ignoreWhenViewDestroyed();
assertFalse(myListFragment.didExecute);
}

@Test
public void notIgnoredAfterOnCreateView() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.onCreateView(null, null, null);
assertFalse(myListFragment.didExecute);
Expand All @@ -133,6 +148,7 @@ public void notIgnoredAfterOnCreateView() {

@Test
public void ignoredWhenViewDestroyedForIgnoredMethod() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.onDestroyView();
myListFragment.ignoreWhenViewDestroyed();
Expand All @@ -141,6 +157,7 @@ public void ignoredWhenViewDestroyedForIgnoredMethod() {

@Test
public void notIgnoredAfterFragmentRecreate() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.onDestroyView();
myListFragment.onCreateView(null, null, null);
Expand All @@ -150,20 +167,23 @@ public void notIgnoredAfterFragmentRecreate() {

@Test
public void notIgnoredBeforeDetached() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.ignored();
assertTrue(myListFragment.didExecute);
}

@Test
public void notIgnoredBeforeViewDestroyed() {
startFragment(myListFragment);
assertFalse(myListFragment.didExecute);
myListFragment.ignoreWhenViewDestroyed();
assertTrue(myListFragment.didExecute);
}

@Test
public void layoutNotInjectedWithoutForce() {
startFragment(myListFragment);
View buttonInInjectedLayout = myListFragment.getView().findViewById(R.id.conventionButton);

assertThat(buttonInInjectedLayout).isNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public JFieldVar getViewDestroyedField() {
}

private void setViewDestroyedField() {
viewDestroyedField = generatedClass.field(PRIVATE | VOLATILE, getCodeModel().BOOLEAN, "viewDestroyed" + generationSuffix());
viewDestroyedField = generatedClass.field(PRIVATE | VOLATILE, getCodeModel().BOOLEAN, "viewDestroyed" + generationSuffix(), TRUE);
getSetContentViewBlock().assign(viewDestroyedField, FALSE);
getOnDestroyViewAfterSuperBlock().assign(viewDestroyedField, TRUE);
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.