[qmtest] Nesting qm.fields.SetField

Mark Mitchell mark at codesourcery.com
Tue Oct 7 14:48:22 UTC 2003


On Tue, 2003-10-07 at 07:13, Anders Hasselqvist wrote:
> Hi,
> 
> I want to have something like this in a test class I'm writing:
> 
> -------------
> qm.fields.SetField(
>   qm.fields.TupleField(
>     name = "filesInMemory",
>     title = "Files in Memory",
>     fields = [
>       qm.fields.EnumerationField(
>         name = "categoryId",
>         title = "Category",
>         enumerals = ['F', 'K', 'L', 'N'],
>         description = """Which file category to check."""
>       ),
>       qm.fields.SetField(
>         qm.fields.IntegerField(
> 	    name = "fileSizes",
>           title = "Sizes",
>           description = """Size of files."""
>         )
>       )
>     ]
>   )
> )
> -------------
> 
> The reason is that there can be several files in every category and I only
> know
> the file size when creating the test case.
> 
> Whats happening now is that when I add a new value in the second SetField it
> behaves like if I press Ok to save the test.
> 
> Is this possible somehow or am I pushing it? :-)

What are you doing should work.

There are two possible problems: a bug in QMTest, or a bug in your
browser.  Complex forms seem to tax even the most modern browsers.

In fields.py, you'll see this comment:

            # The action field is used to keep track of whether the
            # "Add" or "Remove" button has been pushed.  It would be
            # much nice if we could use JavaScript to update the
            # table, but Netscape 4, and even Mozilla 1.0, do not
            # permit that.  Therefore, we have to go back to the
            # server.

It's annoying that we can't do everything on the client side.

The other possibility is that SetField.ParseFormValue is not working
correctly.  You can look through that code; redisplay should get set to
1 when you add a value in the second set field.

-- 
Mark Mitchell <mark at codesourcery.com>
CodeSourcery, LLC




More information about the qmtest mailing list