def test_indexfrompath(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(QModelIndex(), m.indexFromPath('')) self.assertEqual(m.index(1, 0), m.indexFromPath('bar')) self.assertEqual(m.index(0, 0), m.indexFromPath('baz')) self.assertEqual(m.index(0, 0, m.index(0, 0)), m.indexFromPath('baz/bax'))
def test_indexfrompath_qstr(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(m.index(1, 0), m.indexFromPath(QString('bar')))
def test_rowcount_invalid(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(0, m.rowCount(m.index(1, 0)))
def test_pathfromindex(self): m = ManifestModel(self.repo, rev=0) self.assertEqual('', m.filePath(QModelIndex())) self.assertEqual('bar', m.filePath(m.index(1, 0))) self.assertEqual('baz', m.filePath(m.index(0, 0))) self.assertEqual('baz/bax', m.filePath(m.index(0, 0, m.index(0, 0))))
def test_data_inexistent(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(None, m.data(QModelIndex())) self.assertEqual(None, m.data(m.index(0, 0, m.index(1, 0))))
def test_rowcount_subdirs(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(2, m.rowCount(m.index(0, 0)))
def test_data_subdir(self): m = ManifestModel(self.repo, rev=0) self.assertEqual('bax', m.data(m.index(0, 0, m.index(0, 0)))) self.assertEqual('box', m.data(m.index(1, 0, m.index(0, 0))))
def test_data(self): m = ManifestModel(self.repo, rev=0) self.assertEqual('bar', m.data(m.index(1, 0))) self.assertEqual('baz', m.data(m.index(0, 0))) self.assertEqual('foo', m.data(m.index(2, 0)))
def test_indexfrompath(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(m.index(0, 0), m.indexFromPath(_aloha_ja))
def test_pathfromindex(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(_aloha_ja, m.filePath(m.index(0, 0)))
def test_data(self): m = ManifestModel(self.repo, rev=0) self.assertEqual(_aloha_ja, m.data(m.index(0, 0)))