Add BDD tests for pdfjs integration
This commit is contained in:
parent
4fdf318fda
commit
6d02ef68ec
@ -163,3 +163,13 @@ def _read_from_system(system_path, names):
|
|||||||
except OSError:
|
except OSError:
|
||||||
continue
|
continue
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def is_available():
|
||||||
|
"""Return true if a pdfjs installation is available."""
|
||||||
|
try:
|
||||||
|
get_pdfjs_res('build/pdf.js')
|
||||||
|
except PDFJSNotFound:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
BIN
tests/integration/data/misc/test.pdf
Normal file
BIN
tests/integration/data/misc/test.pdf
Normal file
Binary file not shown.
@ -243,3 +243,17 @@ Feature: Various utility commands.
|
|||||||
When I set general -> startpage to http://localhost:(port)/data/numbers/1.txt,http://localhost:(port)/data/numbers/2.txt
|
When I set general -> startpage to http://localhost:(port)/data/numbers/1.txt,http://localhost:(port)/data/numbers/2.txt
|
||||||
And I run :home
|
And I run :home
|
||||||
Then data/numbers/1.txt should be loaded
|
Then data/numbers/1.txt should be loaded
|
||||||
|
|
||||||
|
# pdfjs support
|
||||||
|
|
||||||
|
Scenario: pdfjs is used for pdf files
|
||||||
|
Given pdfjs is available
|
||||||
|
When I set content -> enable-pdfjs to true
|
||||||
|
And I open data/misc/test.pdf
|
||||||
|
Then the javascript message "PDF * [*] (PDF.js: *)" should be logged
|
||||||
|
|
||||||
|
Scenario: pdfjs is not used when disabled
|
||||||
|
When I set content -> enable-pdfjs to false
|
||||||
|
And I set storage -> prompt-download-directory to false
|
||||||
|
And I open data/misc/test.pdf
|
||||||
|
Then "Download finished" should be logged
|
||||||
|
@ -17,5 +17,16 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pytest
|
||||||
import pytest_bdd as bdd
|
import pytest_bdd as bdd
|
||||||
|
|
||||||
|
from qutebrowser.browser import pdfjs
|
||||||
|
|
||||||
|
|
||||||
bdd.scenarios('misc.feature')
|
bdd.scenarios('misc.feature')
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.given('pdfjs is available')
|
||||||
|
def pdfjs_available():
|
||||||
|
if not pdfjs.is_available():
|
||||||
|
pytest.skip("No pdfjs installation found.")
|
||||||
|
Loading…
Reference in New Issue
Block a user