[Git][wxwidgets/wxwidgets][master] 3 commits: Skip some wxNumberFormatter tests under old Windows versions

1 view
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Oct 14, 2025, 7:01:35 AM (7 days ago) Oct 14
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 4c750063
    by utelle at 2025-10-14T12:42:46+02:00
    Skip some wxNumberFormatter tests under old Windows versions
    
    On some Windows platforms locale information used in the number
    formatting tests is not reported correctly.
    
    Adjust CanRunTest() to skip running the tests on such platforms.
    
    See #25675.
    
    Closes #25878.
    
  • 16f0c702
    by Blake-Madden at 2025-10-14T12:44:28+02:00
    Expand wxDEBUG_LEVEL explanation in debugging overview
    
    Expand on how wxDEBUG_LEVEL differences between library and app work.
    Mention the CMake flag used to control the library's wxDEBUG_LEVEL value.
    
    Closes #25876.
    
  • 0135b809
    by ali kettab at 2025-10-14T12:45:29+02:00
    Fix use of wxGC with a scrolled window in drawing sample
    
    A clip region set using SetDeviceClippingRegion() on a DC should not scroll
    when the canvas we are drawing on scrolls.  The drawing sample behaves like
    this if the DC is a wxDC instance but not if it is a wxGC instance (because
    it is not properly prepared when the canvas is scrolled, i.e.: GetDeviceOrigin()
    always returns (0, 0) for a wxGC). So this bug should be fixed by preparing
    the correct DC that we are actually using for drawing.
    
    Closes #25877.
    

3 changed files:

Changes:

  • docs/doxygen/overviews/debugging.h
    ... ... @@ -27,15 +27,19 @@ yourself.
    27 27
     
    
    28 28
     @section overview_debugging_config Configuring Debug Support
    
    29 29
     
    
    30
    -Starting with wxWidgets 2.9.1 debugging features are always available by
    
    30
    +Starting with wxWidgets 2.9.1, debugging features are always available by
    
    31 31
     default (and not only in a special "debug" build of the library) and you need
    
    32
    -to predefine wxDEBUG_LEVEL symbol as 0 when building both the library and your
    
    33
    -application to remove them completely from the generated object code. However
    
    34
    -the debugging features are disabled by default when the application itself is
    
    32
    +to predefine @c wxDEBUG_LEVEL symbol as 0 when building both the library and your
    
    33
    +application to remove them completely from the generated object code.
    
    34
    +(If using CMake and statically linking wxWidgets, set @c wxBUILD_DEBUG_LEVEL to
    
    35
    +the desired level before calling @c add_subdirectory, and set @c wxDEBUG_LEVEL
    
    36
    +when setting compile definitions for your code.)
    
    37
    +
    
    38
    +However the debugging features are disabled by default when the application itself is
    
    35 39
     built with @c NDEBUG defined (i.e. in "release" or "production" mode) so there
    
    36 40
     is no need to do this, unless the resources of the system your application will
    
    37
    -be running on are unusually constrained (notice that when asserts are disabled
    
    38
    -their condition is not even evaluated so the only run-time cost is a single
    
    41
    +be running on are unusually constrained (notice that when asserts are disabled,
    
    42
    +their condition is not even evaluated, so the only run-time cost is a single
    
    39 43
     condition check and the extra space taken by the asserts in the code).
    
    40 44
     
    
    41 45
     This automatic deactivation of debugging code is done by wxIMPLEMENT_APP()
    
    ... ... @@ -43,10 +47,20 @@ macro so if you don't use you may need to explicitly call
    43 47
     wxDISABLE_DEBUG_SUPPORT() yourself.
    
    44 48
     
    
    45 49
     Also notice that it is possible to build your own application with a different
    
    46
    -value of wxDEBUG_LEVEL than the one which was used for wxWidgets itself. E.g.
    
    47
    -you may be using an official binary version of the library which will have been
    
    48
    -compiled with default @code wxDEBUG_LEVEL == 1 @endcode but still predefine
    
    49
    -wxDEBUG_LEVEL as 0 for your own code.
    
    50
    +value of @c wxDEBUG_LEVEL than the one which was used for wxWidgets itself.
    
    51
    +For example, you may be using an official binary version of the library which
    
    52
    +will have been compiled with default @code wxDEBUG_LEVEL == 1 @endcode, but still predefine
    
    53
    +@c wxDEBUG_LEVEL as 0 for your own code.
    
    54
    +
    
    55
    +It is technically allowed to build your application with a higher @c wxDEBUG_LEVEL than the
    
    56
    +`wxDEBUG_LEVEL/wxBUILD_DEBUG_LEVEL` used when compiling wxWidgets itself.
    
    57
    +However, doing so means that debug macros like wxASSERT() or wxLogDebug() will **compile**,
    
    58
    +but effectively become **no-ops at runtime**, since the library does not include the corresponding debug support.
    
    59
    +This won't cause runtime errors or crashes, but it can lead to **confusing behavior**:
    
    60
    +your code may appear to include assertions or debugging checks that simply don't execute.
    
    61
    +For this reason, it's generally **recommended** to keep @c wxDEBUG_LEVEL **less than or
    
    62
    +equal to** the library's `wxDEBUG_LEVEL/wxBUILD_DEBUG_LEVEL`,
    
    63
    +to ensure that debug features behave as expected.
    
    50 64
     
    
    51 65
     On the other hand, if you do want to keep the asserts even in production
    
    52 66
     builds, you will probably want to override the handling of assertion failures
    

  • samples/drawing/drawing.cpp
    ... ... @@ -2100,13 +2100,11 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
    2100 2100
         if ( m_useBuffer )
    
    2101 2101
         {
    
    2102 2102
             wxBufferedPaintDC bpdc(this);
    
    2103
    -        PrepareDC(bpdc); // Adjust scrolled contents.
    
    2104 2103
             Draw(bpdc);
    
    2105 2104
         }
    
    2106 2105
         else
    
    2107 2106
         {
    
    2108 2107
             wxPaintDC pdc(this);
    
    2109
    -        PrepareDC(pdc); // Adjust scrolled contents.
    
    2110 2108
             Draw(pdc);
    
    2111 2109
         }
    
    2112 2110
     }
    
    ... ... @@ -2150,6 +2148,7 @@ void MyCanvas::Draw(wxDC& pdc)
    2150 2148
         wxDC &dc = pdc ;
    
    2151 2149
     #endif
    
    2152 2150
     
    
    2151
    +    PrepareDC(dc); // Adjust scrolled contents.
    
    2153 2152
         m_owner->PrepareDC(dc);
    
    2154 2153
     
    
    2155 2154
         dc.SetBackgroundMode( m_owner->m_backgroundMode );
    

  • tests/strings/numformatter.cpp
    ... ... @@ -375,10 +375,16 @@ protected:
    375 375
             if (ok)
    
    376 376
             {
    
    377 377
                 wxLocaleNumberFormatting numForm = wxUILocale::GetCurrent().GetNumberFormatting();
    
    378
    +            wxLocaleCurrencyInfo currencyInfo = wxUILocale::GetCurrent().GetCurrencyInfo();
    
    379
    +            wxLocaleNumberFormatting curForm = currencyInfo.currencyFormat;
    
    378 380
     #ifdef __GLIBC__
    
    379
    -            ok = numForm.groupSeparator == ".";
    
    381
    +            ok = numForm.groupSeparator == "."
    
    382
    +                && curForm.groupSeparator == wxString::FromUTF8(NNBSP)
    
    383
    +                && currencyInfo.currencySymbolPos == wxCurrencySymbolPosition::PrefixWithSep;
    
    380 384
     #else
    
    381
    -            ok = numForm.groupSeparator == wxString::FromUTF8(NBSP);
    
    385
    +            ok = numForm.groupSeparator == wxString::FromUTF8(NBSP)
    
    386
    +                && curForm.groupSeparator == "."
    
    387
    +                && currencyInfo.currencySymbolPos == wxCurrencySymbolPosition::PrefixWithSep;
    
    382 388
     #endif
    
    383 389
             }
    
    384 390
             return ok;
    
    ... ... @@ -770,7 +776,16 @@ public:
    770 776
         }
    
    771 777
     
    
    772 778
     protected:
    
    773
    -    bool CanRunTest() const { return m_locale.IsOk(); }
    
    779
    +    bool CanRunTest() const
    
    780
    +    {
    
    781
    +        bool ok = m_locale.IsOk();
    
    782
    +        if (ok)
    
    783
    +        {
    
    784
    +            wxLocaleNumberFormatting numForm = wxUILocale::GetCurrent().GetNumberFormatting();
    
    785
    +            ok = (!numForm.grouping.empty() && numForm.grouping.back() == 0);
    
    786
    +        }
    
    787
    +        return ok;
    
    788
    +    }
    
    774 789
     
    
    775 790
     private:
    
    776 791
         wxLocale m_locale;
    

Reply all
Reply to author
Forward
0 new messages