lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] master 3c3454d6 5/5: Allow GUI test to fail


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] master 3c3454d6 5/5: Allow GUI test to fail
Date: Sat, 3 Sep 2022 21:39:18 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

On 9/3/22 12:33, Vadim Zeitlin wrote:
> On Sat, 3 Sep 2022 00:50:03 +0000 Greg Chicares <gchicares@sbcglobal.net> 
> wrote:
> 
> GC> On 9/3/22 00:21, Greg Chicares wrote:
> GC> > On 9/2/22 21:20, Vadim Zeitlin wrote:
> GC> [...]
> GC> >>        $ xvfb-run wine64 /opt/lmi/bin/wx_test.exe --ash_nazg 
> --data_path=Z:/opt/lmi/data
> GC> [...]
> GC> >>  Does the command above also work for you, i.e. is the problem really
> GC> >> specific to the nychthemeral script, or does it hang for you too?
> GC> > 
> GC> > No, it still fails when I copy and paste the command above
> GC> > (full copy of terminal session below), and it fails at exactly
> GC> > the same point as the nychthemeral test:
> GC> > 
> GC> >   paste_census: started
> GC> >   paste_census: ERROR (Assertion 
> '(lmi::ssize(grid_window->GetSelectedRows())) == (1)' failed (
> GC> >   expected 1 vs observed 0). [wx_test_paste_census.cpp : 269] )
> GC> > 
> GC> > after which every subsequent test fails.
> GC> 
> GC> However, if I run only the last five tests (i.e., those that
> GC> follow 'paste_census'), then only one of them fails:
> [...]
> GC> However, if I change DPI from 192 to 96, then your command
> GC> works as intended
> 
>  Thanks, I hadn't thought about changing DPI but, unfortunately, everything
> still works correctly here even after setting it to 192.

Interesting. I can only guess that either wine or xvfb differ between
our machines, or that there's some difference in wine configuration.
However:

>  It should be possible to avoid the assertion failure due to not having any
> selection in the grid by just replacing this code:
> 
> ---------------------------------- >8 --------------------------------------
>      // Change class defaults: this requires a selection, so ensure we have 
> one
>      // by clicking somewhere inside the control.
>      ui.MouseMove
>          (grid_window->ClientToScreen
>              (wxPoint
>                  (10 * grid_window->GetCharWidth()
>                  , 3 * grid_window->GetCharHeight()
>                  )
>              )
>          );
>      ui.MouseClick();
>      wxYield();
> ---------------------------------- >8 --------------------------------------
> 
> with a call to grid_window->SelectRow(0)

Yes, that does work, thanks. I simply added "#if 0" and "#endif // 0"
where you wrote scissors lines above, and added the alternative code
with a semicolon at the end, and now everything works. (I'll remove
the "#if...#endif" block of course.) (I had wondered whether I should
follow SelectRow() with wxYield(), but IIRC SelectRow works immediately
without passing messages through a queue.)

> and it's probably not a huge loss
> to not test that clicking in the grid selects a row in it because if this
> ever got broken, we'd notice it pretty quickly in interactive use, but I
> still don't understand why the code above doesn't work.

The only hypothesis that occurs to me is that we're trying to simulate
a click at a point outside the screen dimensions. But no--I added this
code (changing my "#if 0" to "#if 1", and including <iostream>):

     // by clicking somewhere inside the control.
+    std::cout
+        << "10*W " << 10 * grid_window->GetCharWidth()
+        << " 3*H " <<  3 * grid_window->GetCharHeight()
+        << std::endl
+        ;
     ui.MouseMove

and it said:

  10*W 140 3*H 75
  paste_census: ERROR (Assertion failure: Expected class defaults dialog was 
not shown. [file /
  opt/lmi/src/lmi/wx_test_paste_census.cpp, line 324, in run()].)

That's a different "ERROR" message than before, but the goal of
this new test was to see where the point lies, and [140W, 75H]
would be on the screen even with an ancient CGA monitor. (This
isn't a very good test because I didn't pass that point through
ClientToScreen(), but I suspect this is enough information to
dismiss my hypothesis above.)

> I also have no idea
> why am I not seeing the problem, as I'm using the official lmi build system
> in a chroot dedicated to it, and, worse, don't really know how to debug
> this further without your help and I'm not sure if it's worth wasting your
> time on this.

I'm willing to run tests if you're willing to guess at
corrections that might work. So far, this is working well.

>  Should I just make a properly tested patch with a SelectRow() call?
Not necessary--all I need is an idea that works. Do you have
any idea for fixing the other problem, i.e.:

  validate_output_census: started
  validate_output_census: ERROR (Assertion '0 <= row && row < 
grid_table_->GetRowsCount()' fail
  ed. [census_view.cpp : 1144] )

? I've determined that that error message arises here, in
init_test_census() in file 'wx_test_validate_output.cpp':

    ui.Char('e', wxMOD_CONTROL); // "Census|Edit cell"
    std::cout << "line " << __LINE__ << std::endl;
    // I added the __LINE__ line above, and it prints correctly.
    wxTEST_DIALOG
        (wxYield()
        ,change_name_in_cell_dialog(insured_name)
        );
    // The following added line does not print:
    std::cout << "line " << __LINE__ << std::endl;

Even when I backed up to the function that invokes this:
  LMI_WX_TEST_CASE(validate_output_census)
I didn't see an obvious place to add a line like
  grid_window->SelectRow(0);
which would presumably fix that "ERROR".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]