diff --git a/lib/widgets/mornye_cover_glow.dart b/lib/widgets/mornye_cover_glow.dart index 0a4ad92e0..f48c94abf 100644 --- a/lib/widgets/mornye_cover_glow.dart +++ b/lib/widgets/mornye_cover_glow.dart @@ -284,11 +284,13 @@ class _MornyeCoverGlowState extends State width.toDouble(), artworkHeight * scale, ); + // Whole pixels: a last row the box covered in part would keep part of + // the soft copy under the mask and show as a line at the cover's edge. final soft = Rect.fromLTWH( 0, 0, width.toDouble(), - (artworkHeight - fadeTop) * scale, + math.max(1, ((artworkHeight - fadeTop) * scale).roundToDouble()), ); // Starts under the part of the soft copy that hides the cover, so its // upper edge is never seen. diff --git a/test/mornye_cover_glow_test.dart b/test/mornye_cover_glow_test.dart index 457022462..c97ef96ac 100644 --- a/test/mornye_cover_glow_test.dart +++ b/test/mornye_cover_glow_test.dart @@ -65,6 +65,7 @@ void main() { required String? artUri, bool visible = true, bool reducedMotion = false, + double fadeStart = 0.72, }) async { await tester.pumpWidget( MaterialApp( @@ -76,7 +77,7 @@ void main() { child: MornyeCoverGlow( artUri: artUri, visible: visible, - fadeStart: 0.72, + fadeStart: fadeStart, ), ), ), @@ -164,6 +165,27 @@ void main() { expect(dimmed, greaterThan(mornyeLabelBackgroundLuminance - 0.03)); }); + testWidgets('no line is left where the soft copy ends', (tester) async { + final white = await _cover(tester, directory, const Color(0xffffffff)); + // The fade is 114 dp, 28.5 pixels of the drawn image: its last row is + // covered in half. + await pumpGlow(tester, artUri: white, fadeStart: 0.715); + + final drawn = await pixels(tester); + final colour = pixel(drawn, 50, drawn.$1.height - 1); + // The soft copy is all but gone in its last row, and gone after it. + for (var y = 28; y < 32; y++) { + final row = pixel(drawn, 50, y); + for (var channel = 0; channel < 3; channel++) { + expect( + row[channel], + closeTo(colour[channel], y == 28 ? 3 : 1), + reason: 'row $y', + ); + } + } + }); + test('the one colour is the lower edge as the page shows it', () { // White above. The lower 30%: green at both sides, red then blue in // the middle.