Changeset db7648fa51d4…
Parent 8e525e1b6b45…
by
Changes to 4 files · Browse files at db7648fa51d4 Showing diff from parent 8e525e1b6b45 Diff from another changeset...
|
@@ -0,0 +1,9 @@ + # HG changeset patch
+# User test
+# Date 0 0
+# Node ID b124d3c17d0d93e83d26c00d7a176c02c42d73d1
+# Parent 0000000000000000000000000000000000000000
+add aloha
+
+diff --git a/����ϡ� b/����ϡ�
+new file mode 100644
|
@@ -1,14 +1,18 @@ from nose.tools import *
from PyQt4.QtCore import QModelIndex
from tortoisehg.hgqt.manifestmodel import ManifestModel
-from tests import get_fixture_repo
+from tests import get_fixture_repo, with_encoding
+
+_aloha_ja = u'\u3042\u308d\u306f\u30fc'
def setup():
- global _repo
- _repo = get_fixture_repo('subdirs')
+ global _repos
+ _repos = {}
+ for name in ('subdirs', 'euc-jp-path'):
+ _repos[name] = get_fixture_repo(name)
-def newmodel(rev=0):
- return ManifestModel(_repo, rev=rev)
+def newmodel(name='subdirs', rev=0):
+ return ManifestModel(_repos[name], rev=rev)
def test_data():
m = newmodel()
@@ -26,6 +30,11 @@ assert_equals(None, m.data(QModelIndex()))
assert_equals(None, m.data(m.index(0, 0, m.index(1, 0))))
+@with_encoding('euc-jp')
+def test_data_eucjp():
+ m = newmodel(name='euc-jp-path')
+ assert_equals(_aloha_ja, m.data(m.index(0, 0)))
+
def test_isdir():
m = newmodel()
assert m.isDir(m.indexFromPath(''))
@@ -51,6 +60,11 @@ assert_equals('baz', m.filePath(m.index(0, 0)))
assert_equals('baz/bax', m.filePath(m.index(0, 0, m.index(0, 0))))
+@with_encoding('euc-jp')
+def test_pathfromindex_eucjp():
+ m = newmodel(name='euc-jp-path')
+ assert_equals(_aloha_ja, m.filePath(m.index(0, 0)))
+
def test_indexfrompath():
m = newmodel()
assert_equals(QModelIndex(), m.indexFromPath(''))
@@ -58,6 +72,11 @@ assert_equals(m.index(0, 0), m.indexFromPath('baz'))
assert_equals(m.index(0, 0, m.index(0, 0)), m.indexFromPath('baz/bax'))
+@with_encoding('euc-jp')
+def test_indexfrompath_eucjp():
+ m = newmodel(name='euc-jp-path')
+ assert_equals(m.index(0, 0), m.indexFromPath(_aloha_ja))
+
def test_removed_should_be_listed():
m = newmodel(rev=1)
m.setStatusFilter('MARC')
|
@@ -212,7 +212,7 @@
@pyqtSlot()
def _updatecontent(self):
- if self.path not in self._repo[self._rev]:
+ if hglib.fromunicode(self.path) not in self._repo[self._rev]:
self._contentview.setCurrentWidget(self._nullcontent)
return
|
@@ -14,6 +14,7 @@ from PyQt4.QtGui import *
from mercurial import util
+from tortoisehg.util import hglib
from tortoisehg.hgqt import qtlib, status, visdiff
class ManifestModel(QAbstractItemModel):
@@ -48,6 +49,7 @@ return e.name
def filePath(self, index):
+ """Return path at the given index [unicode]"""
if not index.isValid():
return ''
@@ -112,7 +114,10 @@ return QModelIndex()
def indexFromPath(self, path, column=0):
- """Return index for the specified path if found; otherwise invalid index"""
+ """Return index for the specified path if found [unicode]
+
+ If not found, returns invalid index.
+ """
if not path:
return QModelIndex()
@@ -194,7 +199,7 @@ continue
e = roote
- for p in path.split('/'):
+ for p in hglib.tounicode(path).split('/'):
if not p in e:
e.addchild(p)
e = e[p]
|
Loading...