UI: Set headless-browser width and height

This commit is contained in:
Pavel Shliak 2024-11-13 22:33:12 +04:00 committed by Tim Flynn
parent 1e54003cb1
commit ce56bc29e2
Notes: github-actions[bot] 2024-11-13 21:53:34 +00:00
3 changed files with 5 additions and 2 deletions

View file

@ -46,6 +46,8 @@ void Application::create_platform_arguments(Core::ArgsParser& args_parser)
args_parser.add_option(rebaseline, "Rebaseline any executed layout or text tests", "rebaseline"); args_parser.add_option(rebaseline, "Rebaseline any executed layout or text tests", "rebaseline");
args_parser.add_option(per_test_timeout_in_seconds, "Per-test timeout (default: 30)", "per-test-timeout", 't', "seconds"); args_parser.add_option(per_test_timeout_in_seconds, "Per-test timeout (default: 30)", "per-test-timeout", 't', "seconds");
args_parser.add_option(verbose, "Log extra information about test results", "verbose", 'v'); args_parser.add_option(verbose, "Log extra information about test results", "verbose", 'v');
args_parser.add_option(width, "Set viewport width in pixels (default: 800)", "width", 'W', "pixels");
args_parser.add_option(height, "Set viewport height in pixels (default: 600)", "height", 'H', "pixels");
} }
void Application::create_platform_options(WebView::ChromeOptions& chrome_options, WebView::WebContentOptions& web_content_options) void Application::create_platform_options(WebView::ChromeOptions& chrome_options, WebView::WebContentOptions& web_content_options)

View file

@ -66,6 +66,8 @@ public:
bool rebaseline { false }; bool rebaseline { false };
bool verbose { false }; bool verbose { false };
int per_test_timeout_in_seconds { 30 }; int per_test_timeout_in_seconds { 30 };
int width { 800 };
int height { 600 };
private: private:
RefPtr<Requests::RequestClient> m_request_client; RefPtr<Requests::RequestClient> m_request_client;

View file

@ -71,8 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto theme_path = LexicalPath::join(app->resources_folder, "themes"sv, "Default.ini"sv); auto theme_path = LexicalPath::join(app->resources_folder, "themes"sv, "Default.ini"sv);
auto theme = TRY(Gfx::load_system_theme(theme_path.string())); auto theme = TRY(Gfx::load_system_theme(theme_path.string()));
// FIXME: Allow passing the window size as an argument. static Web::DevicePixelSize window_size { app->width, app->height };
static constexpr Web::DevicePixelSize window_size { 800, 600 };
if (!app->test_root_path.is_empty()) { if (!app->test_root_path.is_empty()) {
app->test_root_path = LexicalPath::absolute_path(TRY(FileSystem::current_working_directory()), app->test_root_path); app->test_root_path = LexicalPath::absolute_path(TRY(FileSystem::current_working_directory()), app->test_root_path);