Update of /cvsroot/mockobjects/no-stone-unturned/doc/xdocs
In directory usw-pr-cvs1:/tmp/cvs-serv9243/doc/xdocs
Modified Files:
testing_guis_1.xml
Log Message:
More stuff on directories
Index: testing_guis_1.xml
===================================================================
RCS file: /cvsroot/mockobjects/no-stone-unturned/doc/xdocs/testing_guis_1.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- testing_guis_1.xml 4 Aug 2002 11:13:28 -0000 1.4
+++ testing_guis_1.xml 5 Aug 2002 01:30:48 -0000 1.5
@@ -461,9 +461,9 @@
&greenbar;
<para>Once again, let's see the application in action:</para>
- <screenshot><mediaobject>
- <imageobject><imagedata fileref="images/gui_example3.gif" format="gif" /></imageobject>
- </mediaobject></screenshot>
+ <screenshot><mediaobject>
+ <imageobject><imagedata fileref="images/gui_example3.gif" format="gif" /></imageobject>
+ </mediaobject></screenshot>
</sect1> <!-- Introducing a Directory -->
@@ -485,15 +485,19 @@
</para>
<programlistingco>
- <areaspec>
- <area id="testOneMatchFound.1" coords="12" />
+ <areaspec units="linecolumn">
+ <area id="expectation.1" coords="3 92" />
+ <area id="actual" coords="7 92" />
+ <area id="searchtext" coords="12 92" />
+ <area id="expectation.2" coords="14 92" />
+ <area id="verify" coords="23 92" />
</areaspec>
<programlisting>
public void testOneMatchFound() {
final ExpectationValue searchString = new ExpectationValue("search string");
Searcher searcher = new Searcher(new Directory() {
- public String lookFor(String aSearchString) {
+ public String searchFor(String aSearchString) {
searchString.setActual(aSearchString);
return "One Result";
}
@@ -510,22 +514,37 @@
assertEquals("Should be status",
"",
((JLabel)findNamedComponent(searcher, "status")).getText().trim());
+ searchString.verify();
}</programlisting>
- <para>I'll step through the changes we've made.</para>
+
<calloutlist>
- <callout arearefs="testOneMatchFound.1">
+ <callout arearefs="expectation.1 expectation.2">
+ <para>
+ We want to check that the contents of the search field is passed through to <function>searchFor()</function>
+ when the button is clicked, so we tell the directory object to <emphasis>expect</emphasis> to receive
+ the search string we've set up.
+ </para>
+ </callout>
+ <callout arearefs="actual">
+ <para>
+ When our dummy <classname>Directory</classname> object is called, we record the value that is passed
+ through and fail if it doesn't match our expectation.
+ </para>
+ </callout>
+ <callout arearefs="searchtext">
<para>
We need a <classname>JTextField</classname> for people to type in their search criterion; that's not an
- interesting failure, so I'll just fix that one.
+ interesting failure, so I'll just fix that and preload a string.
+ </para>
+ </callout>
+ <callout arearefs="verify">
+ <para>
+ At the end of the test, we make sure that the search string has actually been set. This catches failures
+ when <function>searchFor()</function> has not been called.
</para>
</callout>
</calloutlist>
- <!--
- First, we need a <classname>JTextField</classname> for people to type in their search criterion; that's not an
- interesting failure, so I'll just fix that one. Next, we want to ensure that the contents of that text field is
- passed through to the directory object, so we preload the text field and define an expectation
- -->
</programlistingco>
</sect1> <!-- Expecting the search string -->
|