[Mono-list] Nunit hangs when testing a class using the GTK
"Andrés G. Aragoneses"
knocte at gmail.com
Tue Dec 23 18:41:36 EST 2008
Call GType.Init () in a [TestFixtureSetup] method.
Regards,
Andrés
Wolfgang Schulze-Zachau wrote:
> I might be a bit ignorant here, so please bear with me.
> I am running MonoDevelop 2 Alpha 2 on Fedora 9. In my project I use NUnit to
> do all sorts of testing. Today I added a test for a class that is supposed
> to create a popup menu on demand, which can then be displayed in a TreeView.
> Here is the class code so far:
>
>
> using System;
> using Gtk;
>
> namespace Amino.ProCos
> {
>
>
> public class RootProjectTreeNode
> {
>
> public RootProjectTreeNode()
> {
> }
>
> public string DisplayName {
> get { return "All Groups"; }
> }
>
> public Menu getMenu() {
> Menu menu = new Menu();
> MenuItem expand, collapse, addgroup;
> expand = new MenuItem("Expand");
> collapse = new MenuItem("Collapse");
> addgroup = new MenuItem("Add Project Group");
> menu.Add(expand);
> menu.Add(collapse);
> menu.Add(addgroup);
> return menu;
> }
> }
> }
>
> And here is the relevant unit test code:
>
> using System;
> using Gtk;
> using NUnit.Framework;
> using Amino.ProCos;
>
> namespace Amino.testProCos
> {
>
>
> [TestFixture()]
> public class TestRootProjectNode
> {
> RootProjectTreeNode root;
>
> [Test()]
> public void Instantiation()
> {
> root = new RootProjectTreeNode();
> Assert.AreEqual("All Groups", root.DisplayName, "Instantiation of a the
> root project tree node failed");
> }
>
> [Test()]
> public void BasicMenu() {
> root = new RootProjectTreeNode();
> Menu menu = root.getMenu();
> Assert.IsTrue(true, "No idea");
> MenuItem[] items = (MenuItem[])menu.Children;
> Assert.AreEqual(3, items.Length, "menu should contain 3 elements");
> Assert.AreEqual("Expand", items[0].Name, "First popup menu item is not
> 'Expand'");
> Assert.AreEqual("Collapse", items[1].Name, "Second popup menu item is not
> 'Collapse'");
> Assert.AreEqual("Add Project Group", items[3].Name, "Third popup menu
> item is not 'Add Project Group'");
> }
> }
> }
>
> The whole thing compiles without problem. When I run the tests, NUnit hangs.
> The only way out is to open a console and kill the NUnit process. The
> console window from which monodevelop is started, shows error messages such
> as this:
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-CRITICAL **:
> g_once_init_leave: assertion `initialization_value != 0' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE
> (instance_type)' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE
> (instance_type)' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE
> (instance_type)' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-CRITICAL **:
> g_once_init_leave: assertion `initialization_value != 0' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior
> to this function
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-CRITICAL **:
> g_once_init_leave: assertion `initialization_value != 0' failed
>
> (/usr/local/lib/monodevelop/bin/mdhost.exe:15951): GLib-GObject-CRITICAL **:
> g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed
> ERROR [2008-12-23 22:45:43Z]: System.Runtime.Remoting.RemotingException:
> Unix transport error.
>
> The last error is the one thrown by killing the process. I have no idea why
> this is happening, so if anybody can point me in any direction, I would be
> truly grateful.
>
> cheers
> Wolfgang
More information about the Mono-list
mailing list