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: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 3c3454d6 5/5: Allow GUI test to fail
Date: Sun, 4 Sep 2022 14:10:53 +0200

On Sun, 4 Sep 2022 01:38:50 +0000 Greg Chicares <gchicares@sbcglobal.net> wrote:

GC> On 9/3/22 22:14, Vadim Zeitlin wrote:
[...]
GC> >  I can't really guess at correction, my only idea is to print the value
GC> > returned by ClientToScreen() and, maybe, dump the window at this position,
GC> > i.e.
GC> > 
GC> >   std::cout << wxDumpWindow(wxFindWindowAtPoint(...)).utf8_string();
GC> > 
GC> > where "..." stands for the point returned by ClientToScreen().
GC> 
GC> I tried:
GC> 
GC>     std::cout
GC>         << "10*W " << 10 * grid_window->GetCharWidth()
GC>         << " 3*H " <<  3 * grid_window->GetCharHeight()
GC>         << std::endl
GC>         ;
GC>     std::cout << "dump window: " << wxDumpWindow(wxFindWindowAtPoint
GC>         (ClientToScreen
GC>             (wxPoint
GC>                 (10 * grid_window->GetCharWidth()
GC>                 , 3 * grid_window->GetCharHeight()
GC>                 )
GC>             )
GC>         )
GC>                              ).utf8_string();
GC> 
GC> but that doesn't compile:
GC>   error: cannot convert ‘wxPoint’ to ‘HWND’ {aka ‘HWND__*’}

 I'm very puzzled by this because I don't see anything wrong with this
code. FWIW this patch compiles and works as expected for me:
---------------------------------- >8 --------------------------------------
diff --git a/wx_test_paste_census.cpp b/wx_test_paste_census.cpp
index 0178a5dfc..52a2c2a42 100644
--- a/wx_test_paste_census.cpp
+++ b/wx_test_paste_census.cpp
@@ -40,6 +40,7 @@
 #include <wx/uiaction.h>

 #include <algorithm>
+#include <iostream>
 #include <cstring>
 #include <set>
 #include <sstream>
@@ -255,14 +256,19 @@ LMI_WX_TEST_CASE(paste_census)

     // Change class defaults: this requires a selection, so ensure we have one
     // by clicking somewhere inside the control.
-    ui.MouseMove
-        (grid_window->ClientToScreen
+    auto const pt =
+        grid_window->ClientToScreen
             (wxPoint
                 (10 * grid_window->GetCharWidth()
                 , 3 * grid_window->GetCharHeight()
                 )
             )
-        );
+        ;
+    std::cout
+        << "Window at (" << pt.x << ", " << pt.y << "): "
+        << wxDumpWindow(wxFindWindowAtPoint(pt)).utf8_string() << "\n"
+        ;
+    ui.MouseMove(pt);
     ui.MouseClick();
     wxYield();

---------------------------------- >8 --------------------------------------

i.e. outputs this when the test is running:

Window at (123, 256): wxWindow@000000000120c2b0 ("GridWindow", 
HWND=00000000000100aa)

GC> Then the answer is to leave DPI at 96. For any serious work
GC> that requires using lmi's GUI, I'll choose a GTK build.
GC> If I ever must use msw, either I'll change DPI beforehand
GC> and change it back after, or I'll just navigate by sense
GC> of smell.
GC> 
GC> Debugging wine weirdness in a frame buffer is too onerous.

 I can't really disagree with this but, just in case you didn't know about
it yet, one thing I found useful way to be able to peek into the off screen
display using xwd: if Xvfb is running on the default :99 display you can
use this command

        $ xwd -d :99 -root -silent | convert xwd:- screenshot.png

to see what's going on, which can be handy, especially if the test appears
to be hung for an unknown reason. I hope you don't need this tip, but you
might still find it useful if you do :-/

 Sorry again for lack of any real help, I'll keep my DPI setting at 192 and
will try to debug this problem here if I ever run into it.

VZ

Attachment: pgp6g_XWRISwf.pgp
Description: PGP signature


reply via email to

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