Пример #1
0
 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'))
Пример #2
0
 def test_indexfrompath_qstr(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(m.index(1, 0), m.indexFromPath(QString('bar')))
Пример #3
0
 def test_rowcount_invalid(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(0, m.rowCount(m.index(1, 0)))
Пример #4
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))))
Пример #5
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))))
Пример #6
0
 def test_rowcount_subdirs(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(2, m.rowCount(m.index(0, 0)))
Пример #7
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))))
Пример #8
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)))
Пример #9
0
 def test_indexfrompath(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(m.index(0, 0), m.indexFromPath(_aloha_ja))
Пример #10
0
 def test_pathfromindex(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(_aloha_ja, m.filePath(m.index(0, 0)))
Пример #11
0
 def test_data(self):
     m = ManifestModel(self.repo, rev=0)
     self.assertEqual(_aloha_ja, m.data(m.index(0, 0)))