Skip to content

Commit

Permalink
Remember only friends
Browse files Browse the repository at this point in the history
Fixes #2096
  • Loading branch information
1-alex98 committed Jan 4, 2021
1 parent 98db90d commit f95b021
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,12 @@ private void initPassword() {
}

private void bindGameVisibility() {
preferencesService.getPreferences()
.getLastGame()
.lastGameOnlyFriendsProperty()
.bindBidirectional(onlyForFriendsCheckBox.selectedProperty());
onlyForFriendsCheckBox.selectedProperty().bindBidirectional(
preferencesService.getPreferences()
.getLastGame()
.lastGameOnlyFriendsProperty()
);

onlyForFriendsCheckBox.selectedProperty().addListener(observable -> preferencesService.storeInBackground());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.in;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -136,6 +138,15 @@ public void testMapSearchTextFieldFilteringPopulated() {
assertThat(instance.filteredMapBeans.get(1).getDisplayName(), is("Test1"));
}

@Test
public void showOnlyToFriendsRemembered() {
instance.onlyForFriendsCheckBox.setSelected(true);
assertThat(preferences.getLastGame().isLastGameOnlyFriends(), is(true));
instance.onlyForFriendsCheckBox.setSelected(false);
assertThat(preferences.getLastGame().isLastGameOnlyFriends(), is(false));
verify(preferencesService, times(2)).storeInBackground();
}

@Test
public void testMapSearchTextFieldKeyPressedUpForEmpty() {
instance.mapSearchTextField.setText("Test");
Expand Down

0 comments on commit f95b021

Please sign in to comment.