1
- using LibVLCSharp ;
2
- using NUnit . Framework ;
1
+ using NUnit . Framework ;
3
2
using System ;
4
3
using System . Collections . Generic ;
5
4
using System . Diagnostics ;
@@ -13,19 +12,17 @@ namespace LibVLCSharp.Tests
13
12
[ TestFixture ]
14
13
public class LibVLCAPICoverage
15
14
{
16
- const string LibVLCSymURL = "https://raw.githubusercontent.com/videolan/vlc/master/lib/libvlc.sym" ;
17
- const string LibVLCDeprecatedSymUrl = "https://raw.githubusercontent.com/videolan/vlc/master/include/vlc/deprecated.h" ;
15
+ const string LibVLCSymURL = "https://code.videolan.org/videolan/vlc/-/raw/master/lib/libvlc.sym" ;
18
16
19
17
[ Test ]
20
18
public async Task CheckLibVLCCoverage ( )
21
19
{
22
20
string [ ] libvlcSymbols ;
23
- string [ ] libvlcdeprecatedSym ;
24
21
25
22
using ( var httpClient = new HttpClient ( ) )
26
23
{
27
24
libvlcSymbols = ( await httpClient . GetStringAsync ( LibVLCSymURL ) ) . Split ( new [ ] { '\r ' , '\n ' } ) . Where ( s => ! string . IsNullOrEmpty ( s ) ) . ToArray ( ) ;
28
- libvlcdeprecatedSym = ( await httpClient . GetStringAsync ( LibVLCDeprecatedSymUrl ) ) . Split ( new [ ] { ' \r ' , ' \n ' } ) . Where ( s => ! string . IsNullOrEmpty ( s ) ) . ToArray ( ) ;
25
+
29
26
}
30
27
31
28
var dllImports = new List < string > ( ) ;
@@ -48,36 +45,13 @@ public async Task CheckLibVLCCoverage()
48
45
typeof ( MediaList ) ,
49
46
typeof ( Equalizer ) ,
50
47
typeof ( Picture ) ,
48
+ typeof ( PictureList ) ,
49
+ typeof ( MediaTrack ) ,
50
+ typeof ( MediaTrackList ) ,
51
+ typeof ( ProgramList ) ,
51
52
eventManager
52
53
} ;
53
54
54
- var deprecatedSymbolsLine = new List < string > ( ) ;
55
-
56
- for ( var i = 0 ; i < libvlcdeprecatedSym . Count ( ) ; i ++ )
57
- {
58
- var currentLine = libvlcdeprecatedSym [ i ] ;
59
- if ( currentLine . StartsWith ( "LIBVLC_DEPRECATED" ) )
60
- {
61
- deprecatedSymbolsLine . Add ( libvlcdeprecatedSym [ i + 1 ] ) ;
62
- }
63
- }
64
-
65
- var deprecatedSymbols = new List < string > ( ) ;
66
-
67
- foreach ( var symLine in deprecatedSymbolsLine )
68
- {
69
- var libvlcIndexStart = symLine . IndexOf ( "libvlc" ) ;
70
- var sym1 = symLine . Substring ( libvlcIndexStart ) ;
71
- var finalSymbol = new string ( sym1 . TakeWhile ( c => c != '(' ) . ToArray ( ) ) ;
72
-
73
- if ( finalSymbol . Contains ( '*' ) )
74
- {
75
- finalSymbol = finalSymbol . Substring ( finalSymbol . IndexOf ( '*' ) + 1 ) ;
76
- }
77
-
78
- deprecatedSymbols . Add ( finalSymbol . Trim ( ) ) ;
79
- }
80
-
81
55
var implementedButHidden = new List < string >
82
56
{
83
57
"libvlc_media_player_set_android_context" , // android build only
@@ -87,8 +61,7 @@ public async Task CheckLibVLCCoverage()
87
61
// not implemented symbols for lack of use case or user interest
88
62
var notImplementedOnPurpose = new List < string >
89
63
{
90
- "libvlc_clock" , "libvlc_dialog_get_context" , "libvlc_dialog_set_context" ,
91
- "libvlc_event_type_name" , "libvlc_log_get_object" , "libvlc_vlm" , "libvlc_media_list_player" , "libvlc_media_library"
64
+ "libvlc_media_list_player" , "libvlc_dialog_get_context" , "libvlc_dialog_set_context" , "libvlc_log_get_object" , "libvlc_media_player_lock" , "libvlc_media_player_signal" , "libvlc_media_player_unlock" , "libvlc_media_player_wait"
92
65
} ;
93
66
94
67
var exclude = new List < string > ( ) ;
@@ -121,28 +94,15 @@ public async Task CheckLibVLCCoverage()
121
94
122
95
var missingApis = libvlcSymbols
123
96
. Where ( symbol => ! exclude . Any ( excludeSymbol => symbol . StartsWith ( excludeSymbol ) ) ) // Filters out excluded symbols
124
- . Except ( dllImports )
125
- . Except ( deprecatedSymbols ) ;
97
+ . Except ( dllImports ) ;
126
98
127
99
var missingApisCount = missingApis . Count ( ) ;
128
100
129
101
Debug . WriteLine ( $ "we have { dllImports . Count } dll import statements") ;
130
- Debug . WriteLine ( $ "{ missingApisCount } missing APIs implementation") ;
131
102
132
- foreach ( var miss in missingApis )
133
- {
134
- Debug . WriteLine ( miss ) ;
135
- }
136
-
137
- var unusedDllImportsCount = unusedDllImports . Count ( ) ;
138
- Debug . WriteLine ( $ "{ unusedDllImportsCount } unused DllImports implementation") ;
139
- foreach ( var unused in unusedDllImports )
140
- {
141
- Debug . WriteLine ( unused ) ;
142
- }
103
+ Assert . Zero ( missingApis . Count ( ) , string . Concat ( "missing APIs are: " , string . Join ( ", " , missingApis ) ) ) ;
143
104
144
- Assert . Zero ( missingApisCount ) ;
145
- Assert . Zero ( unusedDllImportsCount ) ;
105
+ Assert . Zero ( unusedDllImports . Count ( ) , string . Concat ( "unused dll imports are: " , string . Join ( ", " , unusedDllImports ) ) ) ;
146
106
}
147
107
}
148
108
}
0 commit comments