Re: Debugging widgets



Hi Pavlo,

On Thu, 19 Sep 2019 at 04:26, <p sun fun gmail com> wrote:
Thanks Daniel for the tip.
I tried gtk_init() but it looks like it is not enough for mm version.

Right, I was half awake, and really meant Gtk::Main::init() or whatever the mm wrapping of that C function is.

However, using a Gtk::Application is the preferred way now anyway. :-)
 
Instead, I called Gtk::Application::run() and it works. The code is
follow:

        auto app = Gtk::Application::create("mytest");
        Gtk::Box box;
        app->run();
        BOOST_TEST(box.get_homogeneous() == false);

I also substituted Gtk::Box with my custom widget and everything seems
works just fine.

Great! Probably the run() isn't even needed, as I think the creation of the GtkApplication will suffice to initialise things far enough that you can instantiate widgets and read/write properties.

Of course, if you want to test stuff that requires widgets to actually be realised, etc., then you will indeed need to pack them into a toplevel and run the application in order to make that happen.
 


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