-
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.
[#75] Field selection logic simplified.
- Loading branch information
Showing
3 changed files
with
135 additions
and
30 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
78 changes: 78 additions & 0 deletions
78
Lib/tests/com/yarcat/tests/chemistrylines/SelectionInViewTest.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,78 @@ | ||
package com.yarcat.tests.chemistrylines; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.yarcat.chemistrylines.view.SelectionInView; | ||
|
||
public class SelectionInViewTest { | ||
|
||
SelectionInView s; | ||
|
||
@Before | ||
public void setUp() { | ||
s = new SelectionInView(); | ||
} | ||
|
||
@Test | ||
public void empty() { | ||
assertFalse(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
} | ||
|
||
@Test | ||
public void oneSelect() { | ||
s.select(1); | ||
assertTrue(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
} | ||
|
||
@Test | ||
public void differentCells() { | ||
s.select(1); | ||
s.select(2); | ||
assertTrue(s.hasSource()); | ||
assertTrue(s.hasTarget()); | ||
assertEquals(1, s.getSource()); | ||
assertEquals(2, s.getTarget()); | ||
s.select(3); | ||
assertTrue(s.hasSource()); | ||
assertTrue(s.hasTarget()); | ||
assertEquals(1, s.getSource()); | ||
assertEquals(3, s.getTarget()); | ||
} | ||
|
||
@Test | ||
public void reselectSource() { | ||
s.select(1); | ||
assertTrue(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
s.select(1); | ||
assertFalse(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
s.select(1); | ||
s.select(2); | ||
assertTrue(s.hasSource()); | ||
assertTrue(s.hasTarget()); | ||
s.select(1); | ||
assertFalse(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
} | ||
|
||
@Test | ||
public void clear() { | ||
s.select(1); | ||
s.clear(); | ||
assertFalse(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
s.select(1); | ||
s.select(2); | ||
s.clear(); | ||
assertFalse(s.hasSource()); | ||
assertFalse(s.hasTarget()); | ||
} | ||
} |
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