Skip to content

Commit 9ef6e73

Browse files
author
4b796c65
committed
Merged Typewriter into MetaConsole
1 parent cd20e46 commit 9ef6e73

File tree

4 files changed

+222
-76
lines changed

4 files changed

+222
-76
lines changed

CHANGELOG.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
1+
2+
* Merged the Typewriter and MetaConsole classes,
3+
you now have a virtual cursor with Console and Window objects
24
* Fixed the clear method on Window class
35
* Fixed screenshot function
46
* Fixed some drawing operations with unchanging backgrounds

dev/runRegressionTest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ def getUndrawables(self, console=None):
9797
y = random.randint(0, h)
9898
results.append((x, y))
9999
return results
100+
101+
def compareConsoles(self, consoleA, consoleB, errorMsg='colors should be the same'):
102+
"Compare two console assuming they match and failing if they don't"
103+
self.assertEqual(consoleA.getSize(), consoleB.getSize(), 'consoles should be the same size')
104+
for x, y in self.getDrawables(consoleA):
105+
self.assertEqual(self.consoleA.getChar(x, y),
106+
self.consoleB.getChar(x, y), '%s, position: (%i, %i)' % (errorMsg, x, y))
100107

101108
class BasicTests(TDLTemplate):
102109

@@ -120,15 +127,13 @@ def test_clearConsole(self):
120127
def test_cloneConsole(self):
121128
noiseData = self.randomizeConsole()
122129
clone = copy.copy(self.console)
123-
for x,y in self.getDrawables():
124-
self.assertEqual(self.console.getChar(x, y), clone.getChar(x, y), 'console clone should match root console')
130+
self.compareConsoles(self.console, clone, 'console clone should match root console')
125131

126132
def test_pickleConsole(self):
127133
noiseData = self.randomizeConsole()
128134
pickled = pickle.dumps(self.console)
129135
clone = pickle.loads(pickled)
130-
for x,y in self.getDrawables():
131-
self.assertEqual(self.console.getChar(x, y), clone.getChar(x, y), 'pickled console should match root console')
136+
self.compareConsoles(self.console, clone, 'pickled console should match root console')
132137

133138
def test_changeFonts(self):
134139
"Fonts are changable on the fly... kind of"

0 commit comments

Comments
 (0)