Route default canvas resolution through platform services
This commit is contained in:
@@ -274,6 +274,12 @@ public:
|
||||
++sonarpen_starts;
|
||||
}
|
||||
|
||||
[[nodiscard]] int default_canvas_resolution() override
|
||||
{
|
||||
++default_canvas_resolution_requests;
|
||||
return canvas_resolution;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool draws_canvas_tip_for_pointer(
|
||||
bool is_mouse,
|
||||
bool is_stylus,
|
||||
@@ -362,6 +368,7 @@ public:
|
||||
int ppbr_export_data_directory_override_checks = 0;
|
||||
int sonarpen_support_checks = 0;
|
||||
int sonarpen_starts = 0;
|
||||
int default_canvas_resolution_requests = 0;
|
||||
int canvas_tip_policy_checks = 0;
|
||||
int canvas_pressure_adjustments = 0;
|
||||
int prepare_writable_file_requests = 0;
|
||||
@@ -376,6 +383,7 @@ public:
|
||||
bool network_tls_verification_disabled = false;
|
||||
bool ppbr_export_data_directory_override = false;
|
||||
bool sonarpen_supported = false;
|
||||
int canvas_resolution = 1536;
|
||||
bool canvas_tip_visible = false;
|
||||
bool last_canvas_tip_mouse = false;
|
||||
bool last_canvas_tip_stylus = false;
|
||||
@@ -815,6 +823,17 @@ void platform_services_dispatch_sonarpen_policy_and_start(pp::tests::Harness& ha
|
||||
PP_EXPECT(harness, fake.sonarpen_starts == 1);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_default_canvas_resolution(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
pp::platform::PlatformServices& services = fake;
|
||||
|
||||
PP_EXPECT(harness, services.default_canvas_resolution() == 1536);
|
||||
fake.canvas_resolution = 512;
|
||||
PP_EXPECT(harness, services.default_canvas_resolution() == 512);
|
||||
PP_EXPECT(harness, fake.default_canvas_resolution_requests == 2);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_canvas_input_policy(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
@@ -873,6 +892,7 @@ int main()
|
||||
"platform services dispatch ppbr export directory policy",
|
||||
platform_services_dispatch_ppbr_export_directory_policy);
|
||||
harness.run("platform services dispatch sonarpen policy and start", platform_services_dispatch_sonarpen_policy_and_start);
|
||||
harness.run("platform services dispatch default canvas resolution", platform_services_dispatch_default_canvas_resolution);
|
||||
harness.run("platform services dispatch canvas input policy", platform_services_dispatch_canvas_input_policy);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user