Update to DataDiffSectionSpecTest.java is needed when Litho upgrades RecyclerView support lib version to 1.2.0-alpha02 or newer
yuntao opened this issue · 1 comments
Litho currently depends on androidx.recyclerview:recyclerview:1.0.0
in build.gradle.
In RecyclerView support lib 1.2.0-alpha02, a fix was made to DiffUtil. This will cause Litho's DataDiffSectionSpecTest.java to fail. The following change is needed:
Before:
@Test
public void testMoveData() {
...
assertOperation(newOperation1, MOVE, 1, 0, 1, "1", "1");
...
assertOperation(newOperation2, MOVE, 2, 0, 1, "2", "2");
}
After:
@Test
public void testMoveData() {
...
assertOperation(newOperation1, MOVE, 1, 2, 1, "1", "1");
...
assertOperation(newOperation2, MOVE, 0, 2, 1, "0", "0");
}
This test case verifies the operations done to modify a RecyclerView list from [0, 1, 2] to [2, 1, 0]. Prior to the DiffUtil fix, the two move operations done were [0, 1, 2] -> [1, 0, 2] -> [2, 1, 0]. Now the two move operations are [0, 1, 2] -> [0, 2, 1] -> [2, 1, 0].
In summary, when Litho upgrades RecyclerView support lib to 1.2.0-alpha02 or newer, DataDiffSectionSpecTest.java will fail and need to be updated according to the above.
I noticed that testMoveData()
has been removed due to this exact reason in commit f3e4dbe very recently. The test could be reinstated with the above changes. CC @sturmen
We are on it.