From e70b3d68e3ee685cf6d3eda9f23efe6c3db6d8cc Mon Sep 17 00:00:00 2001 From: CapitaineJSparrow <6690149+CapitaineJSparrow@users.noreply.github.com> Date: Tue, 4 Oct 2022 18:48:18 +0200 Subject: [PATCH] add unit test --- tests/signal.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/signal.js b/tests/signal.js index 77c8c63..ce9a6b2 100644 --- a/tests/signal.js +++ b/tests/signal.js @@ -8,6 +8,7 @@ const Gtk = gi.require('Gtk', '3.0') const Gdk = gi.require('Gdk', '3.0') const GObject = gi.require('GObject') const { describe, it, mustThrow, assert, expect } = require('./__common__.js') +const common = require("./__common__"); gi.startLoop() Gtk.init() @@ -86,6 +87,20 @@ window.on('show', () => { ) }) + describe('Trigger "on-focus-out-event" should work', async () => new Promise((resolve) => { + const entry = new Gtk.SearchEntry(); + const event = new Gdk.EventFocus() + event.type = Gdk.EventType.FOCUS_CHANGE + event.window = entry.getWindow() + event.sendEvent = 1 + + entry.on('focus-out-event', (event) => { + resolve(); + }) + + const result = entry.emit('focus-out-event', event) + })); + describe('types are as correct as possible', () => { const event = new Gdk.EventButton() event.type = Gdk.EventType.BUTTON_PRESS