tests: fix eventbus_test.v

pull/4665/head
Alexander Medvednikov 2020-05-01 10:57:05 +02:00
parent 666801f9f9
commit 51da324465
4 changed files with 13 additions and 3 deletions

View File

@ -7,7 +7,6 @@ import v.pref
const ( const (
skip_test_files = [ skip_test_files = [
'vlib/arrays/arrays_test.v', 'vlib/arrays/arrays_test.v',
'vlib/eventbus/eventbus_test.v',
'vlib/json/json_test.v', 'vlib/json/json_test.v',
'vlib/v/tests/enum_bitfield_test.v', 'vlib/v/tests/enum_bitfield_test.v',
'vlib/v/tests/num_lit_call_method_test.v', 'vlib/v/tests/num_lit_call_method_test.v',

View File

@ -65,8 +65,10 @@ fn (pb mut Publisher) publish(name string, sender voidptr, args voidptr) {
if event.once { if event.once {
pb.registry.events.delete(i) pb.registry.events.delete(i)
} }
if event.receiver != voidptr(0) { //
event.handler(event.receiver, args, sender) x := event.receiver
if x != 0 {
event.handler(x, args, sender)
} else { } else {
event.handler(sender, args, voidptr(0)) event.handler(sender, args, voidptr(0))
} }

View File

@ -9,6 +9,12 @@ import gx
import gg import gg
import glm import glm
import gl import gl
/*
TODO
!!!!!!
Use a font atlas
!!!!!!
*/
#flag windows -I @VROOT/thirdparty/freetype/include #flag windows -I @VROOT/thirdparty/freetype/include
#flag windows -L @VROOT/thirdparty/freetype/win64 #flag windows -L @VROOT/thirdparty/freetype/win64

View File

@ -35,6 +35,9 @@ fn perform_speak(s Speaker) {
assert true assert true
name := s.name() name := s.name()
assert name == 'Dog' || name == 'Cat' assert name == 'Dog' || name == 'Cat'
//if s is Dog {
//assert name == 'Dog'
//}
println(s.name()) println(s.name())
} }