Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
5f427b3f
Commit
5f427b3f
authored
Sep 24, 2006
by
Josh Coalson
Browse files
new tester for testing PICTURE specification parsing
parent
37d44c1a
Changes
8
Hide whitespace changes
Inline
Side-by-side
FLAC.dsw
View file @
5f427b3f
...
...
@@ -93,6 +93,9 @@ Package=<4>
Project_Dep_Name test_cuesheet
End Project Dependency
Begin Project Dependency
Project_Dep_Name test_picture
End Project Dependency
Begin Project Dependency
Project_Dep_Name test_libFLAC
End Project Dependency
Begin Project Dependency
...
...
@@ -174,6 +177,9 @@ Package=<4>
Project_Dep_Name test_cuesheet
End Project Dependency
Begin Project Dependency
Project_Dep_Name test_picture
End Project Dependency
Begin Project Dependency
Project_Dep_Name test_libFLAC
End Project Dependency
Begin Project Dependency
...
...
@@ -504,6 +510,21 @@ Package=<4>
###############################################################################
Project: "test_picture"=.\src\test_grabbag\cuesheet\test_picture.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name grabbag_static
End Project Dependency
}}}
###############################################################################
Project: "test_libs_common"=.\src\test_libs_common\test_libs_common_static.dsp - Package Owner=<4>
Package=<5>
...
...
include/share/grabbag.h
View file @
5f427b3f
...
...
@@ -22,6 +22,7 @@
/* These can't be included by themselves, only from within grabbag.h */
#include
"grabbag/cuesheet.h"
#include
"grabbag/file.h"
#include
"grabbag/picture.h"
#include
"grabbag/replaygain.h"
#include
"grabbag/seektable.h"
...
...
src/test_grabbag/Makefile.am
View file @
5f427b3f
...
...
@@ -15,7 +15,7 @@
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS
=
cuesheet
SUBDIRS
=
cuesheet
picture
EXTRA_DIST
=
\
Makefile.lite
src/test_grabbag/Makefile.lite
View file @
5f427b3f
...
...
@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.PHONY
:
cuesheet
all
:
cuesheet
.PHONY
:
cuesheet
picture
all
:
cuesheet
picture
DEFAULT_CONFIG
=
release
...
...
@@ -32,6 +32,9 @@ release : all
cuesheet
:
(
cd
$@
;
$(MAKE)
-f
Makefile.lite
$(CONFIG)
)
picture
:
(
cd
$@
;
$(MAKE)
-f
Makefile.lite
$(CONFIG)
)
clean
:
-
(
cd
cuesheet
;
$(MAKE)
-f
Makefile.lite clean
)
-
(
cd
picture
;
$(MAKE)
-f
Makefile.lite clean
)
src/test_grabbag/picture/Makefile.am
0 → 100644
View file @
5f427b3f
# test_picture - Simple tester for cuesheet routines in grabbag
# Copyright (C) 2006 Josh Coalson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXTRA_DIST
=
\
Makefile.lite
\
test_picture.dsp
noinst_PROGRAMS
=
test_picture
test_picture_SOURCES
=
\
main.c
test_picture_LDADD
=
\
$(top_builddir)
/src/share/grabbag/libgrabbag.la
\
$(top_builddir)
/src/libFLAC/libFLAC.la
\
-lm
CLEANFILES
=
$(
wildcard
*
.raw
)
src/test_grabbag/picture/Makefile.lite
0 → 100644
View file @
5f427b3f
# test_cuesheet - Simple tester for cuesheet routines in grabbag
# Copyright (C) 2006 Josh Coalson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# GNU makefile
#
topdir
=
../../..
libdir
=
$(topdir)
/obj/
$(BUILD)
/lib
PROGRAM_NAME
=
test_picture
INCLUDES
=
-I
./include
-I
$(topdir)
/include
ifeq
($(DARWIN_BUILD),yes)
EXPLICIT_LIBS
=
$(libdir)
/libgrabbag.a
$(libdir)
/libFLAC.a
-lm
else
LIBS
=
-lgrabbag
-lFLAC
-lm
endif
SRCS_C
=
\
main.c
include
$(topdir)/build/exe.mk
# DO NOT DELETE THIS LINE -- make depend depends on it.
src/test_grabbag/picture/main.c
0 → 100644
View file @
5f427b3f
/* test_picture - Simple tester for cuesheet routines in grabbag
* Copyright (C) 2006 Josh Coalson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include
<string.h>
#include
"FLAC/assert.h"
#include
"share/grabbag.h"
typedef
struct
{
const
char
*
path
;
const
char
*
mime_type
;
const
char
*
description
;
FLAC__uint32
width
;
FLAC__uint32
height
;
FLAC__uint32
depth
;
FLAC__uint32
colors
;
}
PictureFile
;
PictureFile
picturefiles
[]
=
{
{
"0.gif"
,
"image/gif"
,
""
,
24
,
24
,
24
,
2
},
{
"1.gif"
,
"image/gif"
,
""
,
12
,
8
,
24
,
256
},
{
"2.gif"
,
"image/gif"
,
""
,
16
,
14
,
24
,
128
},
{
"0.jpg"
,
"image/jpeg"
,
""
,
30
,
20
,
8
,
0
},
{
"4.jpg"
,
"image/jpeg"
,
""
,
31
,
47
,
24
,
0
},
{
"0.png"
,
"image/png"
,
""
,
30
,
20
,
8
,
0
},
{
"1.png"
,
"image/png"
,
""
,
30
,
20
,
8
,
0
},
{
"2.png"
,
"image/png"
,
""
,
30
,
20
,
24
,
7
},
{
"3.png"
,
"image/png"
,
""
,
30
,
20
,
24
,
7
},
{
"4.png"
,
"image/png"
,
""
,
31
,
47
,
24
,
0
},
{
"5.png"
,
"image/png"
,
""
,
31
,
47
,
24
,
0
},
{
"6.png"
,
"image/png"
,
""
,
31
,
47
,
24
,
23
},
{
"7.png"
,
"image/png"
,
""
,
31
,
47
,
24
,
23
},
{
"8.png"
,
"image/png"
,
""
,
32
,
32
,
32
,
0
}
};
static
FLAC__bool
debug_
=
false
;
static
FLAC__bool
failed_
(
const
char
*
msg
)
{
if
(
msg
)
printf
(
"FAILED, %s
\n
"
,
msg
);
else
printf
(
"FAILED
\n
"
);
return
false
;
}
static
FLAC__bool
test_one_picture
(
const
char
*
prefix
,
const
PictureFile
*
pf
,
const
char
*
res
)
{
FLAC__StreamMetadata
*
obj
;
const
char
*
error
;
char
s
[
4096
];
snprintf
(
s
,
sizeof
(
s
)
-
1
,
"%s|%s|%s|%s/%s"
,
pf
->
mime_type
,
pf
->
description
,
res
,
prefix
,
pf
->
path
);
printf
(
"testing grabbag__picture_parse_specification(
\"
%s
\"
)... "
,
s
);
if
(
0
==
(
obj
=
grabbag__picture_parse_specification
(
s
,
&
error
)))
return
failed_
(
0
);
if
(
debug_
)
{
printf
(
"
\n
mime_type=%s
\n
description=%s
\n
width=%u
\n
height=%u
\n
depth=%u
\n
colors=%u
\n
data_length=%u
\n
"
,
obj
->
data
.
picture
.
mime_type
,
obj
->
data
.
picture
.
description
,
obj
->
data
.
picture
.
width
,
obj
->
data
.
picture
.
height
,
obj
->
data
.
picture
.
depth
,
obj
->
data
.
picture
.
colors
,
obj
->
data
.
picture
.
data_length
);
}
if
(
strcmp
(
obj
->
data
.
picture
.
mime_type
,
pf
->
mime_type
))
return
failed_
(
"picture MIME type mismatch"
);
if
(
strcmp
((
const
char
*
)
obj
->
data
.
picture
.
description
,
(
const
char
*
)
pf
->
description
))
return
failed_
(
"picture description mismatch"
);
if
(
obj
->
data
.
picture
.
width
!=
pf
->
width
)
return
failed_
(
"picture width mismatch"
);
if
(
obj
->
data
.
picture
.
height
!=
pf
->
height
)
return
failed_
(
"picture height mismatch"
);
if
(
obj
->
data
.
picture
.
depth
!=
pf
->
depth
)
return
failed_
(
"picture depth mismatch"
);
if
(
obj
->
data
.
picture
.
colors
!=
pf
->
colors
)
return
failed_
(
"picture colors mismatch"
);
printf
(
"OK
\n
"
);
FLAC__metadata_object_delete
(
obj
);
return
true
;
}
static
FLAC__bool
do_picture
(
const
char
*
prefix
)
{
FLAC__StreamMetadata
*
obj
;
const
char
*
error
;
size_t
i
;
printf
(
"
\n
+++ grabbag unit test: picture
\n\n
"
);
/* invalid spec: no filename */
printf
(
"testing grabbag__picture_parse_specification(
\"\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
""
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected, error: %s)
\n
"
,
error
);
/* invalid spec: no filename */
printf
(
"testing grabbag__picture_parse_specification(
\"
|||
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"|||"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* invalid spec: no filename */
printf
(
"testing grabbag__picture_parse_specification(
\"
image/gif|||
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"image/gif|||"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* invalid spec: bad resolution */
printf
(
"testing grabbag__picture_parse_specification(
\"
image/gif|desc|320|0.gif
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"image/gif|desc|320|0.gif"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* invalid spec: bad resolution */
printf
(
"testing grabbag__picture_parse_specification(
\"
image/gif|desc|320x240|0.gif
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"image/gif|desc|320x240|0.gif"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* invalid spec: no filename */
printf
(
"testing grabbag__picture_parse_specification(
\"
image/gif|desc|320x240x9|
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"image/gif|desc|320x240x9|"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* invalid spec: #colors exceeds color depth */
printf
(
"testing grabbag__picture_parse_specification(
\"
image/gif|desc|320x240x9/2345|0.gif
\"
)... "
);
if
(
0
!=
(
obj
=
grabbag__picture_parse_specification
(
"image/gif|desc|320x240x9/2345|0.gif"
,
&
error
)))
return
failed_
(
"expected error, got object"
);
printf
(
"OK (failed as expected: %s)
\n
"
,
error
);
/* test automatic parsing of picture files to get resolution/color info */
for
(
i
=
0
;
i
<
sizeof
(
picturefiles
)
/
sizeof
(
picturefiles
[
0
]);
i
++
)
if
(
!
test_one_picture
(
prefix
,
picturefiles
+
i
,
""
))
return
false
;
picturefiles
[
0
].
width
=
320
;
picturefiles
[
0
].
height
=
240
;
picturefiles
[
0
].
depth
=
3
;
picturefiles
[
0
].
colors
=
2
;
if
(
!
test_one_picture
(
prefix
,
picturefiles
+
0
,
"320x240x3/2"
))
return
false
;
return
true
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
usage
=
"usage: test_pictures path_prefix
\n
"
;
if
(
argc
>
1
&&
0
==
strcmp
(
argv
[
1
],
"-h"
))
{
printf
(
usage
);
return
0
;
}
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
usage
);
return
255
;
}
return
do_picture
(
argv
[
1
])
?
0
:
1
;
}
src/test_grabbag/picture/test_picture.dsp
0 → 100644
View file @
5f427b3f
# Microsoft Developer Studio Project File - Name="test_cuesheet" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=test_cuesheet - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "test_cuesheet.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "test_cuesheet.mak" CFG="test_cuesheet - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "test_cuesheet - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "test_cuesheet - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "test_cuesheet - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\obj\release\bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ..\..\..\obj\release\lib\grabbag_static.lib ..\..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "test_cuesheet - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\obj\debug\bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "_DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\..\..\obj\debug\lib\grabbag_static.lib ..\..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "test_cuesheet - Win32 Release"
# Name "test_cuesheet - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "c"
# Begin Source File
SOURCE=.\main.c
# End Source File
# End Group
# End Target
# End Project
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment