Exemplo n.º 1
0
        public void TestCreateSource()
        {
            var timeoutInvoked = false;
            var source         = Timeout.CreateSource(0);

            Assert.That(source, Is.Not.Null);

            var context  = new MainContext();
            var mainLoop = new MainLoop(context);

            source.SetCallback(() => {
                mainLoop.Quit();
                timeoutInvoked = true;
                return(Source.Remove_);
            });

            source.Attach(context);
            Task.Run(() => {
                context.PushThreadDefault();
                mainLoop.Run();
                context.PopThreadDefault();
            }).Wait(100);
            source.Destroy();

            Assert.That(timeoutInvoked, Is.True);

            Utility.AssertNoGLibLog();
        }