import 'dart:typed_data';

import 'package:test/test.dart';
import 'package:wolf_3d_dart/wolf_3d_data_types.dart';
import 'package:wolf_3d_dart/wolf_3d_menu.dart';

void main() {
  test(
    'legacy numeric menu IDs are remapped through registry in shareware',
    () {
      final data = WolfensteinData(
        version: GameVersion.shareware,
        dataVersion: DataVersion.version14Shareware,
        registry: SharewareAssetRegistry(strictOriginalShareware: true),
        walls: const [],
        sprites: const [],
        sounds: const [],
        adLibSounds: const [],
        music: const [],
        episodes: const [],
        vgaImages: List.generate(120, (i) => _img(height: i + 1)),
      );

      final art = WolfClassicMenuArt(data);

      // Retail cursor constants 8/9 must resolve to shareware cursor IDs 20/21.
      expect(art.mappedPic(8)?.height, 21);
      expect(art.mappedPic(9)?.height, 22);

      // Retail footer constant 15 must resolve to shareware footer ID 27.
      expect(art.mappedPic(15)?.height, 28);
    },
  );
}

VgaImage _img({required int height}) {
  const width = 4;
  return VgaImage(
    width: width,
    height: height,
    pixels: Uint8List(width * height),
  );
}
