Module: tools Branch: master Commit: b46bbedb3a402690812499d4c593427f00ffafcd URL: https://gitlab.winehq.org/winehq/tools/-/commit/b46bbedb3a402690812499d4c593...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Jul 11 18:46:17 2022 +0200
testbot/cgi: Take into account the form order in GetFirstErrField().
The base Page class does not know in which order the fields are so its GetFirstErrField() method just returns the first invalid field in alphabetical order. But for FormPage it makes more sense to return the first invalid field in the form order.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/lib/ObjectModel/CGI/FormPage.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm index 688ee13a..c299d54b 100644 --- a/testbot/lib/ObjectModel/CGI/FormPage.pm +++ b/testbot/lib/ObjectModel/CGI/FormPage.pm @@ -211,6 +211,35 @@ sub DisplayProperty($$) =pod =over 12
+=item C<GetFirstErrField()> + +Returns the first invalid field in the form order. + +See Page::GetFirstErrField(). + +=back +=cut + +sub GetFirstErrField($) +{ + my ($self) = @_; + + if (defined $self->GetErrMessage()) + { + foreach my $PropertyDescriptor (@{$self->GetPropertyDescriptors()}) + { + if ($self->IsErrField($PropertyDescriptor->GetName())) + { + return $PropertyDescriptor->GetName(); + } + } + } + return undef; +} + +=pod +=over 12 + =item C<GetPropertyValue()>
Returns the underlying property value.