diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-11-19 02:56:49 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-11-19 02:56:49 +0000 |
commit | a2211c4a8caaafd9175311284092ab4cce88cdd5 (patch) | |
tree | 397e23b02cafb50569367c8686a5395e8a62539d | |
parent | 7c272e05c125369e3822481d8529abd3f9e05941 (diff) | |
download | fpc-a2211c4a8caaafd9175311284092ab4cce88cdd5.tar.gz |
+ also check the actual PCM wave data in the fcl-sound wavreader test
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47452 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16.wav.raw | bin | 0 -> 200 bytes | |||
-rw-r--r-- | packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16_tag.wav.raw | bin | 0 -> 200 bytes | |||
-rw-r--r-- | packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_24.wav.raw | bin | 0 -> 300 bytes | |||
-rw-r--r-- | packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_32.wav.raw | bin | 0 -> 400 bytes | |||
-rw-r--r-- | packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_8.wav.raw | 1 | ||||
-rw-r--r-- | packages/fcl-sound/tests/tcwavreader.pas | 26 |
6 files changed, 26 insertions, 1 deletions
diff --git a/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16.wav.raw b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16.wav.raw Binary files differnew file mode 100644 index 0000000000..fc7ac36abf --- /dev/null +++ b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16.wav.raw diff --git a/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16_tag.wav.raw b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16_tag.wav.raw Binary files differnew file mode 100644 index 0000000000..f44c77e0cd --- /dev/null +++ b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_16_tag.wav.raw diff --git a/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_24.wav.raw b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_24.wav.raw Binary files differnew file mode 100644 index 0000000000..7bf9972153 --- /dev/null +++ b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_24.wav.raw diff --git a/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_32.wav.raw b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_32.wav.raw Binary files differnew file mode 100644 index 0000000000..a7d2e39d93 --- /dev/null +++ b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_32.wav.raw diff --git a/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_8.wav.raw b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_8.wav.raw new file mode 100644 index 0000000000..3bc3141cd7 --- /dev/null +++ b/packages/fcl-sound/tests/data/wav/reader/valid/44k_mono_8.wav.raw @@ -0,0 +1 @@ +„«°µ»æĆĒĖĪŠŅÓŌŌÓŅŠĶŹĘĀ½·±«¤wpic\WRNKHGFFGILOTY^djqx~
”£„„¤£”~zvromlkklmoqsvy|
\ No newline at end of file diff --git a/packages/fcl-sound/tests/tcwavreader.pas b/packages/fcl-sound/tests/tcwavreader.pas index d8414544bd..4177f4fd9f 100644 --- a/packages/fcl-sound/tests/tcwavreader.pas +++ b/packages/fcl-sound/tests/tcwavreader.pas @@ -27,7 +27,12 @@ const var WavReader: TWavReader; InfoFile: TextFile; - ExpectedSampleRate, ExpectedChannels, ExpectedBitsPerSample : Integer; + RawDataFile: File; + ExpectedSampleRate, ExpectedChannels, ExpectedBitsPerSample: Integer; + ExpectedData: array of Byte; + ActualData: array of Byte; + ActualDataLen: Integer; + SaveFileMode: Byte; begin AssignFile(InfoFile, CorrectFileDir + FileName + '.info.txt'); Reset(InfoFile); @@ -37,6 +42,21 @@ begin CloseFile(InfoFile); end; + SaveFileMode := FileMode; + try + FileMode := 0; + AssignFile(RawDataFile, CorrectFileDir + FileName + '.raw'); + Reset(RawDataFile, 1); + try + SetLength(ExpectedData, FileSize(RawDataFile)); + BlockRead(RawDataFile, ExpectedData[0], Length(ExpectedData)); + finally + CloseFile(RawDataFile); + end; + finally + FileMode := SaveFileMode; + end; + WavReader := TWavReader.Create; try if not WavReader.LoadFromFile(CorrectFileDir + FileName) then @@ -44,6 +64,10 @@ begin AssertEquals('Incorrect sample rate', ExpectedSampleRate, WavReader.fmt.SampleRate); AssertEquals('Incorrect number of channels', ExpectedChannels, WavReader.fmt.Channels); AssertEquals('Incorrect number of bits per sample', ExpectedBitsPerSample, WavReader.fmt.BitsPerSample); + SetLength(ActualData, Length(ExpectedData)); + ActualDataLen := WavReader.ReadBuf(ActualData[0], Length(ActualData)); + AssertEquals('Data length', Length(ExpectedData), ActualDataLen); + AssertTrue('Data differs', CompareMem(@ExpectedData[0], @ActualData[0], ActualDataLen)); finally FreeAndNil(WavReader); end; |