Example #1
0
        public static void test_simple_task_run()
        {
            efl.ILoop   loop   = efl.App.GetLoopMain();
            eina.Future future = loop.Idle();

            bool callbackCalled = false;
            int  ret_code       = 1992;

            future.Then((eina.Value value) => {
                callbackCalled = true;
                eina.Value v   = new eina.Value(eina.ValueType.Int32);
                v.Set(ret_code);
                loop.Quit(v);
                return(value);
            });
            eina.Value ret_value = loop.Begin();

            Test.Assert(callbackCalled, "Future loop callback must have been called.");

            Test.AssertEquals(ret_value.GetValueType(), eina.ValueType.Int32);

            int ret_from_value;

            Test.Assert(ret_value.Get(out ret_from_value));
            Test.AssertEquals(ret_from_value, ret_code);
        }
Example #2
0
        public static void test_simple_async()
        {
            efl.ILoop loop = efl.App.GetLoopMain();
            Task      t    = LoopConsumer.Consume(loop);

            loop.Begin();
            Test.Assert(t.Wait(1000), "Task should have been completed in time.");
        }