示例#1
0
文件: Events.cs 项目: AmarokPL/efl
        public static void test_add_remove_event()
        {
            var  obj    = new Dummy.TestObject();
            bool called = true;

            EventHandler <Dummy.TestObjectEvtWithIntEventArgs> evtCb = (object sender, Dummy.TestObjectEvtWithIntEventArgs e) => {
                called = true;
            };

            obj.EvtWithIntEvent += evtCb;
            obj.EmitEventWithInt(42);
            Test.Assert(called);

            called = false;
            obj.EvtWithIntEvent -= evtCb;
            obj.EmitEventWithInt(42);
            Test.Assert(!called);
        }
示例#2
0
        public static void eina_error_event_raise_exception()
        {
            // An event whose managed delegate generates an exception
            // must set an eina_error so it can be reported back to
            // the managed code
            var      obj      = new Dummy.TestObject();
            Listener listener = new Listener();

            obj.EvtWithIntEvt += listener.callback;

            Test.AssertRaises <Efl.EflException>(() => { obj.EmitEventWithInt(2); });
        }
示例#3
0
文件: Events.cs 项目: AmarokPL/efl
        public static void event_with_int_payload()
        {
            var obj          = new Dummy.TestObject();
            int received_int = 0;

            obj.EvtWithIntEvent += (object sender, Dummy.TestObjectEvtWithIntEventArgs e) => {
                received_int = e.arg;
            };

            obj.EmitEventWithInt(-1984);

            Test.AssertEquals(-1984, received_int);
        }
示例#4
0
文件: Events.cs 项目: zmike/efl-tmp
        public static void event_in_init_callback()
        {
            int received = 0;
            int sent     = 42;
            var obj      = new Dummy.TestObject();

            obj.EvtWithIntEvt += (object sender, Dummy.TestObjectEvtWithIntEvt_Args e) => {
                received = e.arg;
            };

            obj.EmitEventWithInt(sent);

            Test.AssertEquals(sent, received);
        }