fix(core): tell value-type Auto settings without advice from an advised default
Auto<T>.Resolve returned default instead of the fallback for value types because AutoValue cannot be null there. Auto<T> now records HasAdvice; the render pipeline's ProjectValues workaround and the advisor's ReasonKey heuristic are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
9 files changed
+41
-61
No files matched your search
@@ -30,6 +30,23 @@ public sealed class ProjectSettingsTests
|
||||
Assert.Contains("\"deflickerWindow\"", settings.ToJson());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValueTypesFallBackOnlyWithoutAdvice()
|
||||
{
|
||||
Assert.Equal(21, new Auto<int>().Resolve(21));
|
||||
Assert.Equal(FlowQualitySetting.Balanced, new Auto<FlowQualitySetting>().Resolve(FlowQualitySetting.Balanced));
|
||||
Assert.Equal(0, new Auto<int>().WithAdvice(0, null).Resolve(21));
|
||||
Assert.False(new Auto<bool>().WithAdvice(false, null).Resolve(true));
|
||||
Assert.Equal(0.5, new Auto<double>().WithAdvice(0.8, null).WithManual(0.5).Resolve(1.0));
|
||||
Assert.False(new Auto<bool>().WithManual(false).Resolve(true));
|
||||
var back = ProjectSettings.FromJson(new ProjectSettings
|
||||
{
|
||||
Exposure = new ExposureSettings { Deflicker = new Auto<bool>().WithAdvice(false, null) },
|
||||
}.ToJson());
|
||||
Assert.False(back.Exposure.Deflicker.Resolve(true));
|
||||
Assert.True(ProjectSettings.FromJson(new ProjectSettings().ToJson()).Exposure.Deflicker.Resolve(true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ResetReturnsToAdvice()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user