Index: main/waeup.widgets.core/trunk/src/waeup/widgets/core/tests/test_dictwidget.py
===================================================================
--- main/waeup.widgets.core/trunk/src/waeup/widgets/core/tests/test_dictwidget.py	(revision 5375)
+++ main/waeup.widgets.core/trunk/src/waeup/widgets/core/tests/test_dictwidget.py	(revision 5376)
@@ -156,5 +156,6 @@
         sw = CustomWidgetFactory(DictWidget)
         widget = sw(self.field, request)
-        assert widget.subwidget is None
+        assert widget.key_subwidget is None
+        assert widget.value_subwidget is None
         assert widget.context.value_type is value_type
 
@@ -162,7 +163,7 @@
         class PollOption(object) : pass
         ow = CustomWidgetFactory(ObjectWidget, PollOption)
-        sw = CustomWidgetFactory(DictWidget, subwidget=ow)
+        sw = CustomWidgetFactory(DictWidget, key_subwidget=ow)
         widget = sw(self.field, request)
-        assert widget.subwidget is ow
+        assert widget.key_subwidget is ow
         assert widget.context.value_type is value_type
         assert widget.context.key_type is key_type
@@ -181,8 +182,40 @@
         ow = CustomWidgetFactory(ObjectWidget, PollOption)
         widget = DictWidget(
-            self.field, request, subwidget=ow)
-        assert widget.subwidget is ow
+            self.field, request, key_subwidget=ow, value_subwidget=ow)
+        assert widget.key_subwidget is ow
+        assert widget.value_subwidget is ow
         assert widget() is not None
 
+    def test_renders_subwidgets(self):
+        self.field = Dict(__name__=u'foo',
+                          key_type=TextLine(__name__=u'bar'),
+                          value_type=TextLine(__name__=u'baz'),
+                          )
+        request = TestRequest(form={'field.foo.add': u'Add bar',
+                                    'field.foo.count': u'0'})
+
+        # a text widget the outputs an additional silly header
+        class CustomTextWidget(TextWidget):
+            def __call__(self):
+                result = super(CustomTextWidget, self).__call__()
+                return 'CUSTOM WIDGET\n' + result
+            pass
+        ctw = CustomWidgetFactory(CustomTextWidget)
+        widget = DictWidget(
+            self.field, request, key_subwidget=ctw, value_subwidget=ctw)
+        assert widget.key_subwidget is ctw
+        assert widget.value_subwidget is ctw
+
+        check_list = (
+            'checkbox', 'field.foo.remove_0',
+            'CUSTOM WIDGET',
+            'input', 'field.foo.key.0.bar',
+            'CUSTOM WIDGET',
+            'input', 'field.foo.value.0.baz',
+            'submit', 'submit', 'field.foo.add',
+            'field.foo.count" value="1"',
+        )
+        self.verifyResult(widget(), check_list, inorder=True)
+        
     def test_dict(self):
         self.field = Dict(
@@ -439,4 +472,24 @@
         assert widget.applyChanges(foo_obj) is True
 
+    def test_missing_value(self):
+        self.field.missing_value = u'No Input'
+        request = TestRequest()
+        widget = DictWidget(
+            self.field, request)
+        # Passing a different string than the missing value will mean trouble
+        widget.setRenderedValue('Some string unequal to "No Input"')
+        self.assertRaises(
+            ValueError, widget._getRenderedValue,)
+        # Setting the content to the specified string, however, works:
+        widget.setRenderedValue(u'No Input')
+        assert isinstance(widget._getRenderedValue(), type({}))
+        assert widget._getRenderedValue() == {}
+
+    def test_default_value(self):
+        request = TestRequest()
+        self.field.default = {u'somekey': u'somevalue'}
+        widget = DictWidget(
+            self.field, request)
+        assert widget._getRenderedValue() == {u'somekey': u'somevalue'}
 
 class SequenceDisplayWidgetTest(
@@ -490,11 +543,21 @@
         self.verifyResult(self.widget(), check_list, inorder=True)
 
-    def test_honors_subwidget(self):
+    def test_honors_key_subwidget(self):
         self.widget = self._WidgetFactory(
             self.field, self.request,
-            subwidget=UppercaseDisplayWidget)
+            key_subwidget=UppercaseDisplayWidget)
         self.content.foo = {u'first value': u'second value'}
         check_list = ['<ol', 'class=', 'testwidget',
-                      '<li', 'FIRST VALUE: SECOND VALUE', '</li',
+                      '<li', 'FIRST VALUE: second value', '</li',
+                      '</ol']
+        self.verifyResult(self.widget(), check_list, inorder=True)
+
+    def test_honors_value_subwidget(self):
+        self.widget = self._WidgetFactory(
+            self.field, self.request,
+            value_subwidget=UppercaseDisplayWidget)
+        self.content.foo = {u'first value': u'second value'}
+        check_list = ['<ol', 'class=', 'testwidget',
+                      '<li', 'first value: SECOND VALUE', '</li',
                       '</ol']
         self.verifyResult(self.widget(), check_list, inorder=True)
