@@ -34,7 +34,8 @@ public class CompareComplyV1IntegrationTests
34
34
private string versionDate = "2019-02-13" ;
35
35
private string contractAFilepath ;
36
36
private string contractBFilepath ;
37
- private string tableFilepath ;
37
+ private string tablePdfFilepath ;
38
+ private string tablePngFilepath ;
38
39
private string createdFeedbackId ;
39
40
private string objectStorageCredentialsInputFilepath ;
40
41
private string objectStorageCredentialsOutputFilepath ;
@@ -47,7 +48,8 @@ public void OneTimeSetup()
47
48
48
49
contractAFilepath = Application . dataPath + "/Watson/Tests/TestData/CompareComplyV1/contract_A.pdf" ;
49
50
contractBFilepath = Application . dataPath + "/Watson/Tests/TestData/CompareComplyV1/contract_B.pdf" ;
50
- tableFilepath = Application . dataPath + "/Watson/Tests/TestData/CompareComplyV1/TestTable.pdf" ;
51
+ tablePdfFilepath = Application . dataPath + "/Watson/Tests/TestData/CompareComplyV1/TestTable.pdf" ;
52
+ tablePngFilepath = Application . dataPath + "/Watson/Tests/TestData/CompareComplyV1/TableTestV3.png" ;
51
53
52
54
objectStorageCredentialsInputFilepath = "../sdk-credentials/cloud-object-storage-credentials-input.json" ;
53
55
objectStorageCredentialsOutputFilepath = "../sdk-credentials/cloud-object-storage-credentials-output.json" ;
@@ -137,13 +139,13 @@ public IEnumerator TestClassifyElements()
137
139
}
138
140
#endregion
139
141
140
- #region ExtractTables
142
+ #region ExtractTablesPdf
141
143
[ UnityTest , Order ( 2 ) ]
142
- public IEnumerator TestExtractTables ( )
144
+ public IEnumerator TestExtractPdfTables ( )
143
145
{
144
146
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to ExtractTables..." ) ;
145
147
TableReturn extractTablesResponse = null ;
146
- using ( FileStream fs = File . OpenRead ( tableFilepath ) )
148
+ using ( FileStream fs = File . OpenRead ( tablePdfFilepath ) )
147
149
{
148
150
using ( MemoryStream ms = new MemoryStream ( ) )
149
151
{
@@ -161,19 +163,12 @@ public IEnumerator TestExtractTables()
161
163
Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderIds ) ;
162
164
Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderTexts ) ;
163
165
Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderTextsNormalized ) ;
164
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].RowHeaderIds.Count > 0);
165
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].RowHeaderTexts.Count > 0);
166
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].RowHeaderTextsNormalized.Count > 0);
167
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].ColumnHeaderIds.Count > 0);
168
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].ColumnHeaderTexts.Count > 0);
169
- //Assert.IsTrue(extractTablesResponse.Tables[0].BodyCells[0].ColumnHeaderTextsNormalized.Count > 0);
170
166
Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . KeyValuePairs ) ;
171
- //Assert.IsTrue(extractTablesResponse.Tables[0].KeyValuePairs.Count > 0);
172
167
Assert . IsNull ( error ) ;
173
168
} ,
174
169
file : ms ,
175
170
model : "tables" ,
176
- fileContentType : Utility . GetMimeType ( Path . GetExtension ( tableFilepath ) )
171
+ fileContentType : Utility . GetMimeType ( Path . GetExtension ( tablePdfFilepath ) )
177
172
) ;
178
173
179
174
while ( extractTablesResponse == null )
@@ -183,8 +178,47 @@ public IEnumerator TestExtractTables()
183
178
}
184
179
#endregion
185
180
186
- #region CompareDocuments
181
+ #region ExtractTablesPng
187
182
[ UnityTest , Order ( 3 ) ]
183
+ public IEnumerator TestExtractPngTables ( )
184
+ {
185
+ Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to ExtractTables..." ) ;
186
+ TableReturn extractTablesResponse = null ;
187
+ using ( FileStream fs = File . OpenRead ( tablePngFilepath ) )
188
+ {
189
+ using ( MemoryStream ms = new MemoryStream ( ) )
190
+ {
191
+ fs . CopyTo ( ms ) ;
192
+ service . ExtractTables (
193
+ callback : ( DetailedResponse < TableReturn > response , IBMError error ) =>
194
+ {
195
+ Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "ExtractTables from png file result: {0}" , response . Response ) ;
196
+ extractTablesResponse = response . Result ;
197
+ Assert . IsNotNull ( extractTablesResponse ) ;
198
+ Assert . IsNotNull ( extractTablesResponse . Tables ) ;
199
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . RowHeaderIds ) ;
200
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . RowHeaderTexts ) ;
201
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . RowHeaderTextsNormalized ) ;
202
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderIds ) ;
203
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderTexts ) ;
204
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . BodyCells [ 0 ] . ColumnHeaderTextsNormalized ) ;
205
+ Assert . IsNotNull ( extractTablesResponse . Tables [ 0 ] . KeyValuePairs ) ;
206
+ Assert . IsNull ( error ) ;
207
+ } ,
208
+ file : ms ,
209
+ model : "tables" ,
210
+ fileContentType : Utility . GetMimeType ( Path . GetExtension ( tablePngFilepath ) )
211
+ ) ;
212
+
213
+ while ( extractTablesResponse == null )
214
+ yield return null ;
215
+ }
216
+ }
217
+ }
218
+ #endregion
219
+
220
+ #region CompareDocuments
221
+ [ UnityTest , Order ( 4 ) ]
188
222
public IEnumerator TestCompareDocuments ( )
189
223
{
190
224
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to CompareDocuments..." ) ;
@@ -227,7 +261,7 @@ public IEnumerator TestCompareDocuments()
227
261
#endregion
228
262
229
263
#region AddFeedback
230
- [ UnityTest , Order ( 4 ) ]
264
+ [ UnityTest , Order ( 5 ) ]
231
265
public IEnumerator TestAddFeedback ( )
232
266
{
233
267
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to AddFeedback..." ) ;
@@ -352,7 +386,7 @@ public IEnumerator TestAddFeedback()
352
386
#endregion
353
387
354
388
#region GetFeedback
355
- [ UnityTest , Order ( 5 ) ]
389
+ [ UnityTest , Order ( 6 ) ]
356
390
public IEnumerator TestGetFeedback ( )
357
391
{
358
392
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to GetFeedback..." ) ;
@@ -376,7 +410,7 @@ public IEnumerator TestGetFeedback()
376
410
#endregion
377
411
378
412
#region ListFeedback
379
- [ UnityTest , Order ( 6 ) ]
413
+ [ UnityTest , Order ( 7 ) ]
380
414
public IEnumerator TestListFeedback ( )
381
415
{
382
416
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to ListFeedback..." ) ;
@@ -401,7 +435,7 @@ public IEnumerator TestListFeedback()
401
435
#endregion
402
436
403
437
#region CreateBatch
404
- [ UnityTest , Order ( 7 ) ]
438
+ [ UnityTest , Order ( 8 ) ]
405
439
public IEnumerator TestCreateBatch ( )
406
440
{
407
441
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to CreateBatch..." ) ;
@@ -447,7 +481,7 @@ public IEnumerator TestCreateBatch()
447
481
#endregion
448
482
449
483
#region GetBatch
450
- [ UnityTest , Order ( 8 ) ]
484
+ [ UnityTest , Order ( 9 ) ]
451
485
public IEnumerator TestGetBatch ( )
452
486
{
453
487
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to GetBatch..." ) ;
@@ -470,7 +504,7 @@ public IEnumerator TestGetBatch()
470
504
#endregion
471
505
472
506
#region ListBatches
473
- [ UnityTest , Order ( 9 ) ]
507
+ [ UnityTest , Order ( 10 ) ]
474
508
public IEnumerator TestListBatches ( )
475
509
{
476
510
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to ListBatches..." ) ;
@@ -493,7 +527,7 @@ public IEnumerator TestListBatches()
493
527
#endregion
494
528
495
529
#region UpdateBatch
496
- [ UnityTest , Order ( 10 ) ]
530
+ [ UnityTest , Order ( 11 ) ]
497
531
public IEnumerator TestUpdateBatch ( )
498
532
{
499
533
Log . Debug ( "CompareComplyServiceV1IntegrationTests" , "Attempting to UpdateBatch..." ) ;
0 commit comments