Integrate dialog export and Apple service teams
This commit is contained in:
@@ -3,6 +3,51 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class TestProgressDialog final : public pp::app::AppProgressDialog {
|
||||
public:
|
||||
[[nodiscard]] pp::app::AppDialogKind kind() const noexcept override
|
||||
{
|
||||
return pp::app::AppDialogKind::progress;
|
||||
}
|
||||
};
|
||||
|
||||
class TestMessageDialog final : public pp::app::AppMessageDialog {
|
||||
public:
|
||||
[[nodiscard]] pp::app::AppDialogKind kind() const noexcept override
|
||||
{
|
||||
return pp::app::AppDialogKind::message;
|
||||
}
|
||||
};
|
||||
|
||||
class TestInputDialog final : public pp::app::AppInputDialog {
|
||||
public:
|
||||
[[nodiscard]] pp::app::AppDialogKind kind() const noexcept override
|
||||
{
|
||||
return pp::app::AppDialogKind::input;
|
||||
}
|
||||
};
|
||||
|
||||
class TestDialogFactory final : public pp::app::AppDialogFactory {
|
||||
public:
|
||||
std::shared_ptr<pp::app::AppProgressDialog> show_progress_dialog(
|
||||
const pp::app::AppProgressDialogPlan&) override
|
||||
{
|
||||
return std::make_shared<TestProgressDialog>();
|
||||
}
|
||||
|
||||
std::shared_ptr<pp::app::AppMessageDialog> show_message_dialog(
|
||||
const pp::app::AppMessageDialogPlan&) override
|
||||
{
|
||||
return std::make_shared<TestMessageDialog>();
|
||||
}
|
||||
|
||||
std::shared_ptr<pp::app::AppInputDialog> show_input_dialog(
|
||||
const pp::app::AppInputDialogPlan&) override
|
||||
{
|
||||
return std::make_shared<TestInputDialog>();
|
||||
}
|
||||
};
|
||||
|
||||
void progress_dialog_initializes_progress_state(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_app_progress_dialog("Saving", 12);
|
||||
@@ -62,6 +107,14 @@ void input_dialog_rejects_empty_ok_caption(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, plan.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void dialog_factory_uses_pure_app_core_dialog_types(pp::tests::Harness& harness)
|
||||
{
|
||||
TestDialogFactory factory;
|
||||
PP_EXPECT(harness, factory.show_progress_dialog({})->kind() == pp::app::AppDialogKind::progress);
|
||||
PP_EXPECT(harness, factory.show_message_dialog({})->kind() == pp::app::AppDialogKind::message);
|
||||
PP_EXPECT(harness, factory.show_input_dialog({})->kind() == pp::app::AppDialogKind::input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -74,5 +127,6 @@ int main()
|
||||
harness.run("message dialog allows custom button captions", message_dialog_allows_custom_button_captions);
|
||||
harness.run("input dialog preserves ok caption", input_dialog_preserves_ok_caption);
|
||||
harness.run("input dialog rejects empty ok caption", input_dialog_rejects_empty_ok_caption);
|
||||
harness.run("dialog factory uses pure app-core dialog types", dialog_factory_uses_pure_app_core_dialog_types);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@ void export_snapshot_target_support_covers_document_writer_formats(pp::tests::Ha
|
||||
pp::app::DocumentExportExecutionKind::cube_faces));
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
!pp::app::document_export_snapshot_target_supported(
|
||||
pp::app::document_export_snapshot_target_supported(
|
||||
pp::app::DocumentExportExecutionKind::depth));
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ void export_snapshot_route_for_current_platform_uses_platform_policy(pp::tests::
|
||||
#endif
|
||||
}
|
||||
|
||||
void export_snapshot_route_for_current_platform_reports_depth_fallback(pp::tests::Harness& harness)
|
||||
void export_snapshot_route_for_current_platform_supports_depth_writer(pp::tests::Harness& harness)
|
||||
{
|
||||
pp::app::DocumentCanvasSaveSnapshotReport report;
|
||||
report.payload_complete = true;
|
||||
@@ -940,18 +940,17 @@ void export_snapshot_route_for_current_platform_reports_depth_fallback(pp::tests
|
||||
pp::app::DocumentExportExecutionKind::depth,
|
||||
report);
|
||||
|
||||
PP_EXPECT(harness, !plan.uses_document_snapshot_writer);
|
||||
#if __WEB__
|
||||
PP_EXPECT(harness, !plan.uses_document_snapshot_writer);
|
||||
PP_EXPECT(harness, !plan.platform_supported);
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
plan.fallback_reason == "document snapshot export is disabled on this platform");
|
||||
#else
|
||||
PP_EXPECT(harness, plan.uses_document_snapshot_writer);
|
||||
PP_EXPECT(harness, plan.platform_supported);
|
||||
PP_EXPECT(harness, !plan.target_supported);
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
plan.fallback_reason == "document snapshot export does not support this target");
|
||||
PP_EXPECT(harness, plan.target_supported);
|
||||
PP_EXPECT(harness, plan.fallback_reason.empty());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1382,8 +1381,8 @@ int main()
|
||||
"export snapshot route for current platform uses platform policy",
|
||||
export_snapshot_route_for_current_platform_uses_platform_policy);
|
||||
harness.run(
|
||||
"export snapshot route for current platform reports depth fallback",
|
||||
export_snapshot_route_for_current_platform_reports_depth_fallback);
|
||||
"export snapshot route for current platform supports depth writer",
|
||||
export_snapshot_route_for_current_platform_supports_depth_writer);
|
||||
harness.run(
|
||||
"export snapshot route falls back for pending renderer payloads",
|
||||
export_snapshot_route_falls_back_for_pending_renderer_payloads);
|
||||
|
||||
Reference in New Issue
Block a user