mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
test-web: Reset viewport size after each test
This commit is contained in:
Notes:
github-actions[bot]
2026-02-23 18:45:46 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/6491c6bb90a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7649 Reviewed-by: https://github.com/shannonbooth ✅ Reviewed-by: https://github.com/tcl3
@@ -173,6 +173,16 @@ void HeadlessWebView::initialize_client(CreateNewClient create_new_client)
|
||||
client().async_update_screen_rects(m_client_state.page_index, { { screen_rect } }, 0);
|
||||
}
|
||||
|
||||
void HeadlessWebView::reset_viewport_size(Web::DevicePixelSize size)
|
||||
{
|
||||
m_viewport_size = size;
|
||||
|
||||
client().async_set_window_size(m_client_state.page_index, m_viewport_size);
|
||||
client().async_set_viewport(m_client_state.page_index, m_viewport_size, m_device_pixel_ratio);
|
||||
|
||||
client().async_did_update_window_rect(m_client_state.page_index);
|
||||
}
|
||||
|
||||
void HeadlessWebView::update_zoom()
|
||||
{
|
||||
ViewImplementation::update_zoom();
|
||||
|
||||
@@ -20,6 +20,8 @@ public:
|
||||
static NonnullOwnPtr<HeadlessWebView> create(Core::AnonymousBuffer theme, Web::DevicePixelSize window_size);
|
||||
static NonnullOwnPtr<HeadlessWebView> create_child(HeadlessWebView&, u64 page_index);
|
||||
|
||||
void reset_viewport_size(Web::DevicePixelSize);
|
||||
|
||||
void disconnect_child_crash_handlers()
|
||||
{
|
||||
// Disconnect crash handlers so child crashes don't propagate to parent.
|
||||
|
||||
@@ -1309,9 +1309,11 @@ static ErrorOr<int> run_tests(Core::AnonymousBuffer const& theme, Web::DevicePix
|
||||
// Disconnect child crash handlers so old child crashes don't affect the next test
|
||||
view->disconnect_child_crash_handlers();
|
||||
|
||||
// Don't try to reset zoom if WebContent crashed - it's gone
|
||||
if (test_result != TestResult::Crashed)
|
||||
// Don't try to reset state if WebContent crashed - it's gone
|
||||
if (test_result != TestResult::Crashed) {
|
||||
view->reset_zoom();
|
||||
view->reset_viewport_size(window_size);
|
||||
}
|
||||
|
||||
auto& test = tests[test_index];
|
||||
if (test.timeout_timer) {
|
||||
|
||||
Reference in New Issue
Block a user