The equalizer was a graphic one: 5 to 31 bands at fixed frequencies. Tuning
an earphone to a measurement needs filters with their own frequency, gain
and width (issue 952).
The Equalizer page gets a Graphic / Parametric choice. Parametric holds up
to 20 filters (peak, low shelf, high shelf), each with a frequency from
20 Hz to 20 kHz, a gain of up to 24 dB either way and a Q from 0.1 to 20.
A filter is edited in a sheet with sliders, and each value can be typed
exactly. The bands, Bass and Treble keep their values while the filters
play, and come back with Graphic. The curve, the automatic headroom and
presets follow the mode.
Import also takes the plain text filter list that measurement and tuning
tools exchange ("Preamp: -6.2 dB", "Filter 1: ON PK Fc 105 Hz Gain -2.1 dB
Q 0.70"), and Share filter list writes one. A list that names a preamp
carries its own headroom, so automatic headroom is turned off with it.
Filters of a kind the equalizer has none of are counted and reported.
Every platform plays the same cookbook sections:
- Desktop: libavfilter's equalizer, lowshelf and highshelf, checked
against the formulas by impulse response. The shelves are probed like
the other optional filters and reported when the library lacks them.
- iOS: the plugin's own DSP takes a filters list in place of the bands.
- Android: the platform equalizer is a bank of fixed bands and cannot
hold such a filter, so the filters run in the app's own DSP on the PCM
entering the media3 sink (16, 24 and 32-bit integer and float; 16-bit
output is dithered). It sits in front of the sink, since the sink skips
its processor chain for the float PCM of high resolution songs. The
input gain moves there with the filters, ahead of the platform effect
that keeps balance, compressor and limiter. The platform MediaPlayer
engine cannot do this: with it the equalizer is bypassed while
Parametric is on, and the page says the new playback engine is needed
and offers to turn it on.
A system-wide equalizer, also asked for in the issue, is not part of
this: the app does not attach effects to other apps' audio.
Known: on Android a change is heard about a second late, once the audio
already in the track's buffer has played.
Host tests for Dart code. They run with flutter test and in CI. Device
tests live in integration_test/ (see integration_test/README.md).
Layout
Test files sit directly in test/; only shared code has subfolders.
Path
Contents
test/*_test.dart
All test suites
test/support/
Shared fakes, fixtures and frozen "legacy" baselines, imported by unit and device tests
test/fixtures/
Data files: JSON contract fixtures shared with Rust tests, and a TLS certificate for the WebDAV and artwork proxy tests
Naming
When a suite tests one module, name it after that file:
lib/services/album_completeness.dart is tested by
test/album_completeness_test.dart. Roughly half of the suites follow this.
Otherwise prefix by feature area and describe the behavior, for example
download_queue_persistence_test.dart, library_partial_scan_test.dart,
mornye_bottom_bar_test.dart, network_storage_service_test.dart. The
common prefixes are download_, library_, mornye_, network_,
track_, native_ and extension_.
Put a fake used by more than one suite in test/support/, not in a copy per
file.
Shared Support
File
Use
test/support/fixed_settings.dart
FixedSettingsNotifier: serves fixed AppSettings without reading preferences
test/support/sqlite_process_database.dart
SqliteProcessDatabase: a sqflite Database backed by real SQLite through a python3 child process
test/support/app_icon_finder.dart
findAppIcon: finds an icon drawn by Icon or AppIcon
ReEnrichTestSettings: default settings that skip the lyrics sync to the backend
test/support/virtual_time.dart
VirtualTime: a timer zone that skips idle time while keeping real microtasks
test/support/music_player_automix_harness.dart
Shared AutoMix player fakes used by the music_player_*_test.dart suites
*_benchmark.dart, *_baseline.dart in test/support/
Frozen pre-optimization implementations, compared against production code in unit and device tests
Shared Contract Fixtures
Some fixtures are read by Dart and Rust tests, so both sides parse the same
data: native_library_contract.json, native_metadata_parsers.json,
native_lyrics_parsers.json, native_backup_contract.json and
collection_restore_contract.json in test/fixtures/. Change them only
together with both parsers.
Patterns
Notifier Subclasses
Many tests replace a Riverpod notifier with a small subclass that overrides
build() or one method, then install it with overrideWith:
This is used for DownloadQueueNotifier, DownloadHistoryNotifier,
LocalLibraryNotifier, LibraryCollectionsNotifier, ExtensionNotifier
and SettingsNotifier. Keep the public methods these tests override on the
notifier class itself when refactoring a provider; moving them to a helper
breaks the subclasses.
Source Contract Tests
Several suites read production source text on purpose. Two of them exist
only for that:
test/source_contracts_test.dart pins text across Dart, Kotlin and Swift:
lib/services/app_state_database.dart: database version 4 and its
playback-session migration.
ios/Runner/AppDelegate.swift and
lib/providers/download_queue_provider.dart: the iOS background download
task is acquired before work starts, and expiry cancels downloads before
notifying Dart, which pauses and requeues.
NativeDownloadFinalizer.kt, NativeFinalizerHistory.kt,
NativeHistoryStore.kt and DownloadServiceSnapshot.kt (in
android/app/src/main/kotlin/com/zarz/mornye/), with
lib/services/history_schema.dart and
lib/providers/download_queue_provider_native_worker.dart: the native
worker contract version, the history schema version, columns and
indexes, and the single progress-delta wait.
android/app/src/test/resources/finalization_quality_cases.tsv: quality
labels shared with the Kotlin tests.
test/design_system_test.dart scans every .dart file under lib/:
every IconButton has a tooltip;
only app_sliver_header.dart uses expandedTitleScale;
only app_bottom_sheet.dart draws a drag handle, and only
app_theme.dart sets a modal sheet shape;
only selection_bottom_bar.dart and app_menu_button.dart create an
OverlayEntry;
album_screen.dart, playlist_screen.dart, local_album_screen.dart,
downloaded_album_screen.dart and library_tracks_folder_screen.dart
use CollectionScaffold(, and playlist_screen.dart uses
SelectionModeMixin<PlaylistScreen>;
lib/screens/now_playing_screen.dart uses showAppBottomSheet and no
PopupMenuButton.
Other suites read a production file alongside their behavior tests:
sqlite_helpers_test.dart (lib/services/sqlite_helpers.dart),
downloaded_embedded_cover_resolver_test.dart
(lib/screens/track_metadata_screen_cover.dart and
track_metadata_cards.dart), queue_library_refresh_policy_test.dart
(lib/screens/queue_tab_collection_items.dart), and the schema tests
library_queue_store_test.dart, album_completeness_test.dart,
album_completeness_query_test.dart and replaygain_library_filter_test.dart
(CREATE TABLE text from lib/services/history_schema.dart and
library_schema.dart). Find them with rg -n "File\('(lib|android|ios)/" test.
When a refactor moves pinned code, update the path or the assertion in the
same commit. Never delete these checks.
MORNYE_TEST_FFMPEG selects another FFmpeg binary for
automix_effect_renderer_test.dart. The CI workflow
(.github/workflows/ci.yml) installs ffmpeg before running the tests, so
these cases are not skipped there.
Optional SMB cases are skipped unless their environment is set:
TEST_SMB=1 (with scripts/smb2_fixture_server.py) and TEST_SMB_GUEST_PORT
in network_storage_service_test.dart; TEST_SMB_UPLOAD=1 in
network_smb_upload_test.dart. TEST_SMB_PORT overrides the fixture port.
network_smb_transport_test.dart runs against a loopback server with the
native library bundled by dart_smb2's build hook, without a library override.
Running
flutter test# everything
flutter test test/album_completeness_test.dart # one file
flutter test test/download_queue_persistence_test.dart --plain-name 'restores'
flutter test test/source_contracts_test.dart test/design_system_test.dart
--plain-name filters by a substring of the test name.
test/library_browse_sqlite_paging_test.dart pages 1000 albums through real
SQLite. Alone it took about 25 seconds on a development Mac, close to the
default 30-second per-test timeout, so it can time out when the machine is
busy (for example during a full parallel run). Re-run it alone before treating
a failure as real.