[Skencil-commits] r532 - skencil/trunk/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sun Mar 5 01:04:09 CET 2006
Author: bh
Date: 2006-03-05 01:04:09 +0100 (Sun, 05 Mar 2006)
New Revision: 532
Modified:
skencil/trunk/test/ChangeLog
skencil/trunk/test/test_context.py
Log:
* test_context.py (TestContext.test_set_tool): New. Test the
context objects SetTool method
(MockEditor.SetTool): New for test_set_tool.
Modified: skencil/trunk/test/ChangeLog
===================================================================
--- skencil/trunk/test/ChangeLog 2006-03-04 23:49:56 UTC (rev 531)
+++ skencil/trunk/test/ChangeLog 2006-03-05 00:04:09 UTC (rev 532)
@@ -1,3 +1,9 @@
+2006-03-05 Bernhard Herzog <bh at intevation.de>
+
+ * test_context.py (TestContext.test_set_tool): New. Test the
+ context objects SetTool method
+ (MockEditor.SetTool): New for test_set_tool.
+
2006-03-04 Bernhard Herzog <bh at intevation.de>
* test_tools.py
Modified: skencil/trunk/test/test_context.py
===================================================================
--- skencil/trunk/test/test_context.py 2006-03-04 23:49:56 UTC (rev 531)
+++ skencil/trunk/test/test_context.py 2006-03-05 00:04:09 UTC (rev 532)
@@ -1,5 +1,5 @@
# Skencil - A Python-based interactive drawing program
-# Copyright (C) 2005 by Bernhard Herzog
+# Copyright (C) 2005, 2006 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -41,6 +41,10 @@
def Document(self):
return self.document
+ def SetTool(self, toolname):
+ self.toolname = toolname
+
+
class MockDocument(Publisher):
def IncRef(self):
@@ -57,13 +61,24 @@
self.failUnless(context.tool is None)
def test_tool_with_editor(self):
+ """Test whether the context.tool is the tool of the active editor"""
document = MockDocument()
editor = MockEditor(document, "a_tool")
context = Context(None)
context.set_editor(editor)
self.assertEquals(context.tool, "a_tool")
+ def test_set_tool(self):
+ """Test context.SetTool"""
+ document = MockDocument()
+ editor = MockEditor(document, "a_tool")
+ context = Context(None)
+ context.set_editor(editor)
+ context.SetTool("another_tool")
+ self.assertEquals(editor.toolname, "another_tool")
+
+
if __name__ == "__main__":
unittest.main()
More information about the Skencil-commits
mailing list