mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#46 state:fixed] Fixed crash in Directories panel.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40104
This commit is contained in:
parent
f606cc37d2
commit
51b1b53914
@ -253,8 +253,11 @@ class DupeGuru(app.DupeGuru):
|
|||||||
assert not node_path # no other value is possible
|
assert not node_path # no other value is possible
|
||||||
return [len(g.dupes) for g in self.results.groups]
|
return [len(g.dupes) for g in self.results.groups]
|
||||||
elif tag == 1: #Directories
|
elif tag == 1: #Directories
|
||||||
dirs = self.GetDirectory(node_path).dirs if node_path else self.directories
|
try:
|
||||||
return [d.dircount for d in dirs]
|
dirs = self.GetDirectory(node_path).dirs if node_path else self.directories
|
||||||
|
return [d.dircount for d in dirs]
|
||||||
|
except IndexError: # node_path out of range
|
||||||
|
return []
|
||||||
else: #Power Marker
|
else: #Power Marker
|
||||||
assert not node_path # no other value is possible
|
assert not node_path # no other value is possible
|
||||||
return [0 for d in self.results.dupes]
|
return [0 for d in self.results.dupes]
|
||||||
@ -275,11 +278,11 @@ class DupeGuru(app.DupeGuru):
|
|||||||
result = self.data.GetDisplayInfo(d, g, self.display_delta_values)
|
result = self.data.GetDisplayInfo(d, g, self.display_delta_values)
|
||||||
return result
|
return result
|
||||||
elif tag == 1: #Directories
|
elif tag == 1: #Directories
|
||||||
d = self.GetDirectory(node_path)
|
try:
|
||||||
return [
|
d = self.GetDirectory(node_path)
|
||||||
d.name,
|
return [d.name, self.directories.get_state(d.path)]
|
||||||
self.directories.get_state(d.path)
|
except IndexError: # node_path out of range
|
||||||
]
|
return []
|
||||||
|
|
||||||
def GetOutlineViewMarked(self, tag, node_path):
|
def GetOutlineViewMarked(self, tag, node_path):
|
||||||
# 0=unmarked 1=marked 2=unmarkable
|
# 0=unmarked 1=marked 2=unmarkable
|
||||||
|
@ -17,6 +17,7 @@ from nose.tools import eq_
|
|||||||
from hsutil.path import Path
|
from hsutil.path import Path
|
||||||
from hsutil.testcase import TestCase
|
from hsutil.testcase import TestCase
|
||||||
from hsutil.decorators import log_calls
|
from hsutil.decorators import log_calls
|
||||||
|
from hsutil import io
|
||||||
import hsfs.phys
|
import hsfs.phys
|
||||||
|
|
||||||
from .results_test import GetTestGroups
|
from .results_test import GetTestGroups
|
||||||
@ -44,6 +45,10 @@ class TCDupeGuru(TestCase):
|
|||||||
self.app = DupeGuru()
|
self.app = DupeGuru()
|
||||||
self.objects,self.matches,self.groups = GetTestGroups()
|
self.objects,self.matches,self.groups = GetTestGroups()
|
||||||
self.app.results.groups = self.groups
|
self.app.results.groups = self.groups
|
||||||
|
tmppath = self.tmppath()
|
||||||
|
io.mkdir(tmppath + 'foo')
|
||||||
|
io.mkdir(tmppath + 'bar')
|
||||||
|
self.app.directories.add_path(tmppath)
|
||||||
|
|
||||||
def test_GetObjects(self):
|
def test_GetObjects(self):
|
||||||
app = self.app
|
app = self.app
|
||||||
@ -241,9 +246,10 @@ class TCDupeGuru(TestCase):
|
|||||||
self.assertEqual(0,len(app.results.dupes))
|
self.assertEqual(0,len(app.results.dupes))
|
||||||
|
|
||||||
def test_addDirectory_simple(self):
|
def test_addDirectory_simple(self):
|
||||||
|
# There's already a directory in self.app, so adding another once makes 2 of em
|
||||||
app = self.app
|
app = self.app
|
||||||
self.assertEqual(0,app.add_directory(self.datadirpath()))
|
eq_(app.add_directory(self.datadirpath()), 0)
|
||||||
self.assertEqual(1,len(app.directories))
|
eq_(len(app.directories), 2)
|
||||||
|
|
||||||
def test_addDirectory_already_there(self):
|
def test_addDirectory_already_there(self):
|
||||||
app = self.app
|
app = self.app
|
||||||
@ -289,6 +295,18 @@ class TCDupeGuru(TestCase):
|
|||||||
app.SelectPowerMarkerNodePaths(r2np([2])) #The dupe of the second, 2 sized group
|
app.SelectPowerMarkerNodePaths(r2np([2])) #The dupe of the second, 2 sized group
|
||||||
app.AddSelectedToIgnoreList()
|
app.AddSelectedToIgnoreList()
|
||||||
|
|
||||||
|
def test_GetOutlineViewChildCounts_out_of_range(self):
|
||||||
|
# Out of range requests don't crash and return an empty value
|
||||||
|
app = self.app
|
||||||
|
# [0, 2] is out of range
|
||||||
|
eq_(app.GetOutlineViewChildCounts(1, [0, 2]), []) # no crash
|
||||||
|
|
||||||
|
def test_GetOutlineViewValues_out_of_range(self):
|
||||||
|
# Out of range requests don't crash and return an empty value
|
||||||
|
app = self.app
|
||||||
|
# [0, 2] is out of range
|
||||||
|
eq_(app.GetOutlineViewValues(1, [0, 2]), []) # no crash
|
||||||
|
|
||||||
|
|
||||||
class TCDupeGuru_renameSelected(TestCase):
|
class TCDupeGuru_renameSelected(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user