mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 18:29:19 +02:00
quick try at adding DC_EVENT names and use them to deltachat bindings
This commit is contained in:
parent
eec2261cca
commit
0340dbe81c
3 changed files with 40 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
from __future__ import print_function
|
||||
import deltachat
|
||||
from deltachat import capi
|
||||
from deltachat import capi, get_dc_event_name
|
||||
from deltachat.capi import ffi
|
||||
import queue
|
||||
|
||||
|
||||
|
@ -9,6 +10,10 @@ def test_empty_context():
|
|||
capi.lib.dc_close(ctx)
|
||||
|
||||
|
||||
def test_event_defines():
|
||||
assert capi.lib.DC_EVENT_INFO == 100
|
||||
|
||||
|
||||
def test_cb(register_dc_callback):
|
||||
def cb(ctx, evt, data1, data2):
|
||||
return 0
|
||||
|
@ -34,7 +39,9 @@ def test_basic_events(dc_context, dc_threads, register_dc_callback, tmpdir, user
|
|||
|
||||
while 1:
|
||||
evt1, data1, data2 = q.get(timeout=1.0)
|
||||
if evt1 == 100:
|
||||
print ("info event", data2)
|
||||
if evt1 == capi.lib.DC_EVENT_INFO:
|
||||
s = ffi.string(ffi.cast('char*', data2))
|
||||
print ("info event", s)
|
||||
elif evt1:
|
||||
print ("other event", evt1, data1, data2)
|
||||
name = get_dc_event_name(evt1)
|
||||
print ("other event", name, data1, data2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue