public void ValidateIndexPath() { RunOnUIThread.Execute(() => { IndexPath path = IndexPath.CreateFromIndices(null); Verify.AreEqual(0, path.GetSize()); path = IndexPath.CreateFrom(5); Verify.AreEqual(1, path.GetSize()); Verify.AreEqual(5, path.GetAt(0)); path = IndexPath.CreateFrom(1, 2); Verify.AreEqual(2, path.GetSize()); Verify.AreEqual(1, path.GetAt(0)); Verify.AreEqual(2, path.GetAt(1)); Verify.AreEqual(0, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(0, 1))); Verify.AreEqual(-1, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(1, 0))); Verify.AreEqual(1, IndexPath.CreateFrom(0, 1).CompareTo(IndexPath.CreateFrom(0, 0))); Verify.AreEqual(-1, IndexPath.CreateFrom(1, 0).CompareTo(IndexPath.CreateFrom(1, 1))); Verify.AreEqual(0, IndexPath.CreateFrom(1, 0).CompareTo(IndexPath.CreateFrom(1, 0))); Verify.AreEqual(1, IndexPath.CreateFrom(1, 1).CompareTo(IndexPath.CreateFrom(1, 0))); var emptyPath = IndexPath.CreateFromIndices(null); Verify.AreEqual(0, emptyPath.CompareTo(emptyPath)); var path1 = IndexPath.CreateFrom(1); Verify.AreEqual(-1, emptyPath.CompareTo(path1)); Verify.AreEqual(1, path1.CompareTo(emptyPath)); var path12 = IndexPath.CreateFrom(1, 2); Verify.AreEqual(-1, path1.CompareTo(path12)); Verify.AreEqual(1, path12.CompareTo(path1)); }); }
public void SelectRangeRegressionTest() { RunOnUIThread.Execute(() => { var selectionModel = new SelectionModel() { Source = CreateNestedData(1, 2, 3) }; // length of start smaller than end used to cause an out of range error. selectionModel.SelectRange(IndexPath.CreateFrom(0), IndexPath.CreateFrom(1, 1)); ValidateSelection(selectionModel, new List <IndexPath>() { Path(0, 0), Path(0, 1), Path(0, 2), Path(0), Path(1, 0), Path(1, 1) }, new List <IndexPath>() { Path(), Path(1) }, 1 /* selectedInnerNodes */); }); }
public void ValidateCanSetSelectedIndex() { RunOnUIThread.Execute(() => { var model = new SelectionModel(); var ip = IndexPath.CreateFrom(34); model.SelectedIndex = ip; Verify.AreEqual(0, ip.CompareTo(model.SelectedIndex)); }); }