add support for linking pdfs we can't/won't distribute
This commit is contained in:
		
							parent
							
								
									2dff6d818c
								
							
						
					
					
						commit
						375c4bf529
					
				
							
								
								
									
										23
									
								
								test.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								test.py
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
			
		||||
import json, os, sys, subprocess
 | 
			
		||||
import json, os, sys, subprocess, urllib2
 | 
			
		||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
 | 
			
		||||
from urlparse import urlparse
 | 
			
		||||
 | 
			
		||||
@ -82,6 +82,8 @@ class PDFTestHandler(BaseHTTPRequestHandler):
 | 
			
		||||
 | 
			
		||||
        if result['taskDone']:
 | 
			
		||||
            check(State.manifest[id], taskResults, browser)
 | 
			
		||||
            # Please oh please GC this ...
 | 
			
		||||
            del State.taskResults[browser][id]
 | 
			
		||||
            State.remaining -= 1
 | 
			
		||||
 | 
			
		||||
        State.done = (0 == State.remaining)
 | 
			
		||||
@ -100,6 +102,23 @@ def set_up(manifestFile):
 | 
			
		||||
    manifestList = json.load(mf)
 | 
			
		||||
    mf.close()
 | 
			
		||||
 | 
			
		||||
    for item in manifestList:
 | 
			
		||||
        f, isLink = item['file'], item.get('link', False)
 | 
			
		||||
        if isLink and not os.access(f, os.R_OK):
 | 
			
		||||
            linkFile = open(f +'.link')
 | 
			
		||||
            link = linkFile.read()
 | 
			
		||||
            linkFile.close()
 | 
			
		||||
 | 
			
		||||
            sys.stdout.write('Downloading '+ link +' to '+ f +' ...')
 | 
			
		||||
            sys.stdout.flush()
 | 
			
		||||
            response = urllib2.urlopen(link)
 | 
			
		||||
 | 
			
		||||
            out = open(f, 'w')
 | 
			
		||||
            out.write(response.read())
 | 
			
		||||
            out.close()
 | 
			
		||||
 | 
			
		||||
            print 'done'
 | 
			
		||||
 | 
			
		||||
    for b in testBrowsers:
 | 
			
		||||
        State.taskResults[b] = { }
 | 
			
		||||
        for item in manifestList:
 | 
			
		||||
@ -169,8 +188,6 @@ def checkEq(task, results, browser):
 | 
			
		||||
        print 'TEST-PASS | eq test', task['id'], '| in', browser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
printed = [False]
 | 
			
		||||
 | 
			
		||||
def checkFBF(task, results, browser):
 | 
			
		||||
    round0, round1 = results[0], results[1]
 | 
			
		||||
    assert len(round0) == len(round1)
 | 
			
		||||
 | 
			
		||||
@ -13,5 +13,11 @@
 | 
			
		||||
       "file": "tests/canvas.pdf",
 | 
			
		||||
       "rounds": 1,
 | 
			
		||||
       "type": "load"
 | 
			
		||||
    },
 | 
			
		||||
    {  "id": "pdfspec-load",
 | 
			
		||||
       "file": "tests/pdf.pdf",
 | 
			
		||||
       "link": true,
 | 
			
		||||
       "rounds": 1,
 | 
			
		||||
       "type": "load"
 | 
			
		||||
    }
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								tests/pdf.pdf.link
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/pdf.pdf.link
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user