wxWidgets + CppUnit

Vadim Zeitlin vadim at wxwindows.org
Fri Jun 1 05:20:21 PDT 2007


On Sun, 27 May 2007 12:09:35 -0400 "T.J. VanSlyke" <teejay.vanslyke at gmail.com> wrote:

TV> I am working on a project which has recently incorporated wxWidgets as its
TV> widgets toolkit.  We are also using CppUnit as our unit testing suite, and
TV> rely heavily on our tests to catch regressions.  However, when I try to test
TV> custom wxWidgets components using CppUnit, I am confronted with segmentation
TV> faults whenever I attempt to instantiate any widgets.  I am assuming this is
TV> because I haven't run the IMPLEMENT_APP(app) macro

 More precisely, because you didn't initialize the library. IMPLEMENT_APP
macro is not the only way to do it, you can also use wxInitialize and
wxUninitialize functions. Be warned that currently things don't work if
you try to initialize the library after shutting it down (this is something
we'd like to fix and would welcome any contributions towards it but didn't
have time to do it ourselves yet).

TV> which, I assume, creates a valid wxWidgets context within which to
TV> work.  Is anyone currently using CppUnit to do widgets testing, and, if
TV> so, how are you creating the proper context?

 The tests in tests subdirectory do use CppUnit, however they don't use any
widgets. I am not really sure how do you intend to test widgets with
CppUnit anyhow to be honest. The wxSwTesting framework already mentioned in
this thread should be a better choice for this.

 Regards,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list