Fixes #2767 Make preview option sticky in projects#2768
Conversation
📝 WalkthroughWalkthroughAdds persistence and UI propagation for chart PreviewSettings: mapper copies PreviewSettings to templates, serializers include PreviewSettings in XML, template-to-chart initialization assigns PreviewSettings to charts, and the presenter/view expose/update watermark state accordingly. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Chart
participant Mapper
participant Template
participant Serializer
participant Storage
participant Loader
participant Service
participant Presenter
participant View
User->>Chart: set PreviewSettings
User->>Storage: save project
Chart->>Mapper: MapFrom(chart)
Mapper->>Template: copy PreviewSettings
Template->>Serializer: Serialize (includes PreviewSettings)
Serializer->>Storage: write XML
User->>Storage: load project
Storage->>Loader: read XML
Loader->>Template: Deserialize (restores PreviewSettings)
Template->>Service: InitializeChartFromTemplate
Service->>Chart: assign PreviewSettings
Chart->>Presenter: notify
Presenter->>View: UpdateWatermark()
View->>User: display watermark state
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@tests/OSPSuite.Core.Tests/Mappers/CurveChartToCurveChartTemplateMapperSpecs.cs`:
- Around line 88-92: The test should not assert a value against itself; in the
should_have_the_preview_settings_set test replace the self-comparison of
_curveChart.PreviewSettings with a comparison that verifies the mapping
propagated the value to the target, e.g., assert that
_curveChartTemplate.PreviewSettings equals _curveChart.PreviewSettings; update
the assertion in the should_have_the_preview_settings_set method to compare
_curveChartTemplate.PreviewSettings with _curveChart.PreviewSettings.
tests/OSPSuite.Core.Tests/Mappers/CurveChartToCurveChartTemplateMapperSpecs.cs
Show resolved
Hide resolved
|
|
||
| /// <summary> | ||
| /// Applies the watermark to the chart if the chart is in preview mode and auto update is enabled, otherwise does nothing | ||
| /// </summary> | ||
| void UpdateWatermark(); |
There was a problem hiding this comment.
but only if the show watermark user option is enabled, correct?
There was a problem hiding this comment.
yes, that's covered by ApplicationSettings
public string WatermarkTextToUse => UseWatermark.GetValueOrDefault(false) ? WatermarkText : null;
Fixes #2767 Make preview option sticky in projects
Description
Allows the export preview option to be retained by project save, and also added to templates, and used from templates.
Type of change
Please mark relevant options with an
xin the brackets.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Reviewer checklist
Mark everything that needs to be checked before merging the PR.
This change requires a documentation updateabove is selectedScreenshots (if appropriate):
Questions (if appropriate):
Summary by CodeRabbit
New Features
Tests