Route platform frame hooks through services
This commit is contained in:
@@ -40,6 +40,18 @@ public:
|
||||
keyboard_visible = visible;
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
++platform_frame_updates;
|
||||
last_platform_delta = delta_time_seconds;
|
||||
}
|
||||
|
||||
void report_rendered_frames(int frames) override
|
||||
{
|
||||
++frame_reports;
|
||||
last_frame_report = frames;
|
||||
}
|
||||
|
||||
void display_file(std::string_view path) override
|
||||
{
|
||||
++display_file_requests;
|
||||
@@ -98,6 +110,8 @@ public:
|
||||
int clipboard_writes = 0;
|
||||
int cursor_updates = 0;
|
||||
int keyboard_updates = 0;
|
||||
int platform_frame_updates = 0;
|
||||
int frame_reports = 0;
|
||||
int display_file_requests = 0;
|
||||
int share_file_requests = 0;
|
||||
int app_close_requests = 0;
|
||||
@@ -109,6 +123,8 @@ public:
|
||||
bool cursor_visible = false;
|
||||
bool keyboard_visible = false;
|
||||
bool prepared_file_saved = true;
|
||||
float last_platform_delta = 0.0f;
|
||||
int last_frame_report = 0;
|
||||
std::string displayed_path;
|
||||
std::string shared_path;
|
||||
std::string prepared_file_path;
|
||||
@@ -161,6 +177,20 @@ void platform_services_dispatch_visibility_updates(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, !fake.keyboard_visible);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
pp::platform::PlatformServices& services = fake;
|
||||
|
||||
services.update_platform_frame(0.125f);
|
||||
services.report_rendered_frames(42);
|
||||
|
||||
PP_EXPECT(harness, fake.platform_frame_updates == 1);
|
||||
PP_EXPECT(harness, fake.last_platform_delta == 0.125f);
|
||||
PP_EXPECT(harness, fake.frame_reports == 1);
|
||||
PP_EXPECT(harness, fake.last_frame_report == 42);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_file_actions(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
@@ -233,6 +263,7 @@ int main()
|
||||
harness.run("platform services dispatch clipboard reads and writes", platform_services_dispatch_clipboard_reads_and_writes);
|
||||
harness.run("platform services preserve empty clipboard writes", platform_services_preserve_empty_clipboard_writes);
|
||||
harness.run("platform services dispatch visibility updates", platform_services_dispatch_visibility_updates);
|
||||
harness.run("platform services dispatch frame hooks", platform_services_dispatch_frame_hooks);
|
||||
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
|
||||
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);
|
||||
harness.run("platform services dispatch prepared file save", platform_services_dispatch_prepared_file_save);
|
||||
|
||||
Reference in New Issue
Block a user