Skip to content

Commit f63a357

Browse files
committed
Actualize testing proxy
1 parent 71cc873 commit f63a357

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

tests/Stub/TestingApplicationStub.php

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,66 @@ protected function createLibSaucer(?string $library): SaucerTestingStub
2727
$stub->addDefaultMethod('cast', fn(string $t, CData $ptr) => $ptr);
2828
$stub->addDefaultMethod('new', $this->createStruct(...));
2929

30-
$stub->addDefaultMethod('saucer_options_new', fn(mixed ...$args): CData
31-
=> $this->createStruct('saucer_options_new', $args));
30+
$stub->addDefaultMethod('saucer_application_new', fn(mixed ...$args): CData
31+
=> $this->createStruct('saucer_application_new', $args));
3232

33-
$stub->addDefaultMethod('saucer_preferences_new', fn(mixed ...$args): CData
34-
=> $this->createStruct('saucer_preferences_new', $args));
33+
$stub->addDefaultMethod('saucer_application_options_new', fn(mixed ...$args): CData
34+
=> $this->createStruct('saucer_application_options_new', $args));
35+
36+
$stub->addDefaultMethod('saucer_loop_new', fn(mixed ...$args): CData
37+
=> $this->createStruct('saucer_loop_new', $args));
3538

3639
$stub->addDefaultMethod('saucer_desktop_new', fn(mixed ...$args): CData
3740
=> $this->createStruct('saucer_desktop_new', $args));
3841

39-
$stub->addDefaultMethod('saucer_application_init', fn(mixed ...$args): CData
40-
=> $this->createStruct('saucer_application_init', $args));
42+
$stub->addDefaultMethod('saucer_window_new', fn(mixed ...$args): CData
43+
=> $this->createStruct('saucer_window_new', $args));
44+
45+
$stub->addDefaultMethod('saucer_webview_options_new', fn(mixed ...$args): CData
46+
=> $this->createStruct('saucer_webview_options_new', $args));
4147

42-
$stub->addDefaultMethod('saucer_new', fn(mixed ...$args): CData
43-
=> $this->createStruct('saucer_new', $args));
48+
$stub->addDefaultMethod('saucer_webview_new', fn(mixed ...$args): CData
49+
=> $this->createStruct('saucer_webview_new', $args));
4450

4551
$stub->addDefaultMethod('saucer_script_new', fn(mixed ...$args): CData
4652
=> $this->createStruct('saucer_script_new', $args));
4753

48-
$stub->addDefaultMethod('saucer_preferences_set_persistent_cookies');
49-
$stub->addDefaultMethod('saucer_preferences_add_browser_flag');
54+
$stub->addDefaultMethod('saucer_webview_options_append_browser_flag');
55+
$stub->addDefaultMethod('saucer_webview_options_set_persistent_cookies');
56+
$stub->addDefaultMethod('saucer_webview_options_set_hardware_acceleration');
5057

51-
$stub->addDefaultMethod('saucer_application_run_once');
58+
$stub->addDefaultMethod('saucer_loop_iteration');
5259

5360
$stub->addDefaultMethod('saucer_window_set_size');
61+
$stub->addDefaultMethod('saucer_window_set_title');
62+
$stub->addDefaultMethod('saucer_window_set_resizable');
5463
$stub->addDefaultMethod('saucer_window_set_decorations');
55-
$stub->addDefaultMethod('saucer_window_on');
64+
$stub->addDefaultMethod('saucer_window_on', static fn(): int => 0xDEAD_BEEF);
65+
$stub->addDefaultMethod('saucer_window_off');
5666
$stub->addDefaultMethod('saucer_window_show');
67+
$stub->addDefaultMethod('saucer_window_set_always_on_top');
68+
$stub->addDefaultMethod('saucer_window_set_click_through');
5769

5870
$stub->addDefaultMethod('saucer_webview_set_context_menu');
5971
$stub->addDefaultMethod('saucer_webview_set_dev_tools');
60-
$stub->addDefaultMethod('saucer_webview_inject');
61-
$stub->addDefaultMethod('saucer_webview_on');
62-
$stub->addDefaultMethod('saucer_webview_on_message');
72+
$stub->addDefaultMethod('saucer_webview_inject', static fn(): int => 0xDEAD_BEEF);
73+
$stub->addDefaultMethod('saucer_webview_on', static fn(): int => 0xDEAD_BEEF);
6374
$stub->addDefaultMethod('saucer_webview_background');
64-
$stub->addDefaultMethod('saucer_webview_force_dark_mode');
75+
$stub->addDefaultMethod('saucer_webview_set_force_dark');
6576
$stub->addDefaultMethod('saucer_webview_set_background');
6677

6778
$stub->addDefaultMethod('saucer_script_set_permanent');
6879

6980
// cleanup
7081

71-
$stub->addDefaultMethod('saucer_free');
82+
$stub->addDefaultMethod('saucer_application_options_free');
7283
$stub->addDefaultMethod('saucer_desktop_free');
73-
$stub->addDefaultMethod('saucer_preferences_free');
74-
$stub->addDefaultMethod('saucer_options_free');
75-
$stub->addDefaultMethod('saucer_script_free');
76-
$stub->addDefaultMethod('saucer_application_free');
77-
78-
$stub->addDefaultMethod('saucer_webview_clear_scripts');
79-
$stub->addDefaultMethod('saucer_webview_clear_embedded');
80-
84+
$stub->addDefaultMethod('saucer_loop_free');
85+
$stub->addDefaultMethod('saucer_window_free');
86+
$stub->addDefaultMethod('saucer_webview_options_free');
8187
$stub->addDefaultMethod('saucer_application_quit');
88+
$stub->addDefaultMethod('saucer_webview_uninject_all');
89+
$stub->addDefaultMethod('saucer_webview_uninject');
8290

8391
return $stub;
8492
}
@@ -102,7 +110,8 @@ protected function createStruct(string $type, array $args = []): CData
102110
{
103111
return match (true) {
104112
$this->isWebViewEventsStruct($type) => \FFI::cdef(<<<'C'
105-
typedef void* saucer_handle;
113+
typedef void* saucer_webview;
114+
typedef void* saucer_url;
106115
typedef void* saucer_navigation;
107116
typedef void* saucer_icon;
108117
@@ -111,9 +120,10 @@ protected function createStruct(string $type, array $args = []): CData
111120
C)
112121
->new($type),
113122
$this->isWindowEventsStruct($type) => \FFI::cdef(<<<'C'
114-
typedef void* saucer_handle;
123+
typedef void* saucer_window;
115124
116125
typedef int32_t SAUCER_POLICY;
126+
typedef int32_t SAUCER_WINDOW_DECORATION;
117127
C)
118128
->new($type),
119129
default => \FFI::cdef()

0 commit comments

Comments
 (0)