mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Implements tests for commit 2e9f7d8496
This commit is contained in:
1 parent
a75447062f
commit
468f1846f1
18 files changed
+1711
-48
No files matched your search
+54
-2
@@ -34,6 +34,24 @@ public class UserSettingsDtoFixture
|
||||
/// <param name="isGaplessPlaybackEnabled">Whether the player transitions between consecutive tracks without a gap.</param>
|
||||
/// <param name="replayGainMode">The way ReplayGain normalization is applied to the tracks the user plays.</param>
|
||||
/// <param name="streamingQuality">The quality cap applied to the audio the server normalizes for the user.</param>
|
||||
/// <param name="vuMeterOrientation">The direction in which each channel of the VU meter of the audio player grows.</param>
|
||||
/// <param name="vuMeterSegmentCount">The number of segments each channel of the VU meter is divided into.</param>
|
||||
/// <param name="vuMeterSegmentGap">The gap, in pixels, between the segments and the channels of the VU meter.</param>
|
||||
/// <param name="vuMeterMediumThreshold">The level above which a segment of the VU meter is drawn with its medium state.</param>
|
||||
/// <param name="vuMeterHighThreshold">The level above which a segment of the VU meter is drawn with its high state.</param>
|
||||
/// <param name="vuMeterShowPeak">Whether the VU meter holds the peak level of each channel after it falls.</param>
|
||||
/// <param name="vuMeterPeakHoldDurationInMilliseconds">The time a peak of the VU meter is held before it starts falling.</param>
|
||||
/// <param name="vuMeterReleasePerSecond">The number of level units the display of the VU meter falls per second when the input level drops.</param>
|
||||
/// <param name="vuMeterPeakReleasePerSecond">The number of level units the peak of the VU meter falls per second after its hold time elapsed.</param>
|
||||
/// <param name="includeVuMeterOrientation">Whether to generate the VU meter orientation, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterSegmentCount">Whether to generate the VU meter segment count, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterSegmentGap">Whether to generate the VU meter segment gap, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterMediumThreshold">Whether to generate the VU meter medium threshold, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterHighThreshold">Whether to generate the VU meter high threshold, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterShowPeak">Whether to generate the VU meter peak marker setting, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterPeakHoldDurationInMilliseconds">Whether to generate the VU meter peak hold duration, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterReleasePerSecond">Whether to generate the VU meter release rate, or leave it <see langword="null"/>.</param>
|
||||
/// <param name="includeVuMeterPeakReleasePerSecond">Whether to generate the VU meter peak release rate, or leave it <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="UserSettingsDto"/> instance.</returns>
|
||||
public UserSettingsDto Create(
|
||||
Guid? userId = null,
|
||||
@@ -48,8 +66,33 @@ public class UserSettingsDtoFixture
|
||||
bool? shouldAutoplay = null,
|
||||
bool? isGaplessPlaybackEnabled = null,
|
||||
ReplayGainMode? replayGainMode = null,
|
||||
PlaybackStreamingQuality? streamingQuality = null)
|
||||
PlaybackStreamingQuality? streamingQuality = null,
|
||||
VuMeterOrientation? vuMeterOrientation = null,
|
||||
int? vuMeterSegmentCount = null,
|
||||
int? vuMeterSegmentGap = null,
|
||||
double? vuMeterMediumThreshold = null,
|
||||
double? vuMeterHighThreshold = null,
|
||||
bool? vuMeterShowPeak = null,
|
||||
int? vuMeterPeakHoldDurationInMilliseconds = null,
|
||||
double? vuMeterReleasePerSecond = null,
|
||||
double? vuMeterPeakReleasePerSecond = null,
|
||||
bool includeVuMeterOrientation = true,
|
||||
bool includeVuMeterSegmentCount = true,
|
||||
bool includeVuMeterSegmentGap = true,
|
||||
bool includeVuMeterMediumThreshold = true,
|
||||
bool includeVuMeterHighThreshold = true,
|
||||
bool includeVuMeterShowPeak = true,
|
||||
bool includeVuMeterPeakHoldDurationInMilliseconds = true,
|
||||
bool includeVuMeterReleasePerSecond = true,
|
||||
bool includeVuMeterPeakReleasePerSecond = true)
|
||||
{
|
||||
// The high threshold is generated from the medium one, so a randomized meter always describes a valid meter.
|
||||
double? mediumThreshold = includeVuMeterMediumThreshold
|
||||
? vuMeterMediumThreshold ?? _faker.Random.Double(0, 1)
|
||||
: null;
|
||||
double? highThreshold = includeVuMeterHighThreshold
|
||||
? vuMeterHighThreshold ?? (mediumThreshold is null ? _faker.Random.Double(0, 1) : _faker.Random.Double(mediumThreshold.Value, 1))
|
||||
: null;
|
||||
return new UserSettingsDto
|
||||
{
|
||||
UserId = userId ?? Guid.NewGuid(),
|
||||
@@ -64,7 +107,16 @@ public class UserSettingsDtoFixture
|
||||
ShouldAutoplay = shouldAutoplay ?? _faker.Random.Bool(),
|
||||
IsGaplessPlaybackEnabled = isGaplessPlaybackEnabled ?? _faker.Random.Bool(),
|
||||
ReplayGainMode = replayGainMode ?? _faker.PickRandom<ReplayGainMode>(),
|
||||
StreamingQuality = streamingQuality ?? _faker.PickRandom<PlaybackStreamingQuality>()
|
||||
StreamingQuality = streamingQuality ?? _faker.PickRandom<PlaybackStreamingQuality>(),
|
||||
VuMeterOrientation = includeVuMeterOrientation ? vuMeterOrientation ?? _faker.PickRandom<VuMeterOrientation>() : null,
|
||||
VuMeterSegmentCount = includeVuMeterSegmentCount ? vuMeterSegmentCount ?? _faker.Random.Int(1, 128) : null,
|
||||
VuMeterSegmentGap = includeVuMeterSegmentGap ? vuMeterSegmentGap ?? _faker.Random.Int(0, 32) : null,
|
||||
VuMeterMediumThreshold = mediumThreshold,
|
||||
VuMeterHighThreshold = highThreshold,
|
||||
VuMeterShowPeak = includeVuMeterShowPeak ? vuMeterShowPeak ?? _faker.Random.Bool() : null,
|
||||
VuMeterPeakHoldDurationInMilliseconds = includeVuMeterPeakHoldDurationInMilliseconds ? vuMeterPeakHoldDurationInMilliseconds ?? _faker.Random.Int(0, 10000) : null,
|
||||
VuMeterReleasePerSecond = includeVuMeterReleasePerSecond ? vuMeterReleasePerSecond ?? _faker.Random.Double(0, 100) : null,
|
||||
VuMeterPeakReleasePerSecond = includeVuMeterPeakReleasePerSecond ? vuMeterPeakReleasePerSecond ?? _faker.Random.Double(0, 100) : null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user