mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Merge pull request #40 from cobexer/unify-tests
Unify tests: moved common code into tests/test.js; run tests from source instead from built version
This commit is contained in:
commit
433d7ce81c
@ -8,19 +8,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Background attribute tests</title>
|
<title>Background attribute tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
|
|
||||||
$('body').html2canvas({
|
|
||||||
logging:true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.small div{
|
.small div{
|
||||||
|
@ -9,19 +9,7 @@
|
|||||||
<title>border tests</title>
|
<title>border tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
<script type="text/javascript" src="../external/flashcanvas/flashcanvas.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
|
|
||||||
$('body').html2canvas({
|
|
||||||
logging:true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
div { font: 12px Arial; }
|
div { font: 12px Arial; }
|
||||||
|
@ -3,18 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>External content tests</title>
|
<title>External content tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Iframe</h1>
|
<h1>Iframe</h1>
|
||||||
|
@ -10,14 +10,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -5,11 +5,9 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(window).ready(function() {
|
function setUp() {
|
||||||
var ctx = $('#testcanvas')[0].getContext('2d');
|
var ctx = $('#testcanvas')[0].getContext('2d');
|
||||||
|
|
||||||
ctx.fillStyle = "rgb(200,0,0)";
|
ctx.fillStyle = "rgb(200,0,0)";
|
||||||
@ -17,9 +15,7 @@
|
|||||||
|
|
||||||
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
|
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
|
||||||
ctx.fillRect (30, 30, 55, 50);
|
ctx.fillRect (30, 30, 55, 50);
|
||||||
|
};
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -8,22 +8,15 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>List tests</title>
|
<title>List tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(window).ready(function() {
|
function setUp() {
|
||||||
var supportedTypes = ["decimal","decimal-leading-zero","upper-roman","lower-roman","lower-alpha","upper-alpha"];
|
var supportedTypes = ["decimal","decimal-leading-zero","upper-roman","lower-roman","lower-alpha","upper-alpha"];
|
||||||
for (var i = 1;i<=100;i++){
|
for (var i = 1;i<=100;i++){
|
||||||
|
|
||||||
$('#dynamic').append($('<li />').text(i).css('list-style-type',supportedTypes[Math.round(Math.random()*supportedTypes.length)]));
|
$('#dynamic').append($('<li />').text(i).css('list-style-type',supportedTypes[Math.round(Math.random()*supportedTypes.length)]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -4,16 +4,7 @@
|
|||||||
<title>Overflow tests</title>
|
<title>Overflow tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
$('body').html2canvas({letterRendering:true});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.small{
|
.small{
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
|
@ -3,16 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>External content tests</title>
|
<title>External content tests</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<base href="http://www.google.com/" />
|
<base href="http://www.google.com/" />
|
||||||
</head>
|
</head>
|
||||||
|
25
tests/test.js
Normal file
25
tests/test.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
html2canvas @VERSION@ <http://html2canvas.hertzen.com>
|
||||||
|
Copyright (c) 2011 Niklas von Hertzen. All rights reserved.
|
||||||
|
http://www.twitter.com/niklasvh
|
||||||
|
|
||||||
|
Released under MIT License
|
||||||
|
*/
|
||||||
|
(function(document, window) {
|
||||||
|
var scrStart = '<script type="text/javascript" src="', scrEnd = '"></script>';
|
||||||
|
document.write(scrStart + '../external/jquery-1.6.2.min.js' + scrEnd);
|
||||||
|
var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'plugins/jquery.plugin.html2canvas'], i;
|
||||||
|
for (i = 0; i < html2canvas.length; ++i) {
|
||||||
|
document.write(scrStart + '../src/' + html2canvas[i] + '.js' + scrEnd);
|
||||||
|
}
|
||||||
|
window.onload = function() {
|
||||||
|
if (window.setUp) {
|
||||||
|
window.setUp();
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
$(document.body).html2canvas({
|
||||||
|
logging: true
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
}(document, window));
|
@ -10,28 +10,17 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(window).ready(function() {
|
function setUp() {
|
||||||
$('body').empty();
|
$('body').empty();
|
||||||
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
||||||
|
|
||||||
var div = $('<div />').css('font-family',e).appendTo('body');
|
var div = $('<div />').css('font-family',e).appendTo('body');
|
||||||
|
for(var i=0;i<=20;i++){
|
||||||
for(var i=0;i<=20;i++){
|
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
||||||
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
window.setTimeout(function(){
|
|
||||||
$('body').html2canvas();
|
|
||||||
},100);
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,28 +10,18 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(window).ready(function() {
|
function setUp() {
|
||||||
$('body').empty();
|
$('body').empty();
|
||||||
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
||||||
|
|
||||||
var div = $('<div />').css('font-family',e).appendTo('body');
|
var div = $('<div />').css('font-family',e).appendTo('body');
|
||||||
|
|
||||||
for(var i=0;i<=20;i++){
|
for(var i=0;i<=20;i++){
|
||||||
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
window.setTimeout(function(){
|
|
||||||
$('body').html2canvas();
|
|
||||||
},100);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,29 +10,18 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(window).ready(function() {
|
function setUp() {
|
||||||
|
|
||||||
$('body').empty();
|
$('body').empty();
|
||||||
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
$.each(['arial','verdana','tahoma','courier new'],function(i,e){
|
||||||
|
|
||||||
var div = $('<div />').css('font-family',e).appendTo('body');
|
var div = $('<div />').css('font-family',e).appendTo('body');
|
||||||
|
|
||||||
for(var i=0;i<=20;i++){
|
for(var i=0;i<=20;i++){
|
||||||
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
$('<div />').text('Testing texts').css('margin-top',1).css('border','1px solid black').css('font-size',(16+i*6)).appendTo(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
window.setTimeout(function(){
|
|
||||||
$('body').html2canvas();
|
|
||||||
},100);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,15 +10,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
$('body').html2canvas();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.small{
|
.small{
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
|
@ -10,15 +10,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
|
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
new html2canvas($('body').get(0));
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div{
|
div{
|
||||||
border:2px solid black;
|
border:2px solid black;
|
||||||
|
@ -9,18 +9,7 @@
|
|||||||
<title>z-index tests #1</title>
|
<title>z-index tests #1</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js?12"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
|
|
||||||
$('body').html2canvas({
|
|
||||||
logging:true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
div { font: 12px Arial; }
|
div { font: 12px Arial; }
|
||||||
|
@ -9,18 +9,7 @@
|
|||||||
<title>z-index tests #2</title>
|
<title>z-index tests #2</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
|
|
||||||
$('body').html2canvas({
|
|
||||||
logging:true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
div { font: 12px Arial; }
|
div { font: 12px Arial; }
|
||||||
|
@ -9,18 +9,7 @@
|
|||||||
<title>z-index tests #3</title>
|
<title>z-index tests #3</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link href="#" type="text/css" rel="stylesheet">
|
<link href="#" type="text/css" rel="stylesheet">
|
||||||
<script type="text/javascript" src="../external/jquery-1.6.2.min.js"></script>
|
<script type="text/javascript" src="test.js"></script>
|
||||||
<script type="text/javascript" src="../build/html2canvas.js"></script>
|
|
||||||
<script type="text/javascript" src="../build/jquery.plugin.html2canvas.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).ready(function() {
|
|
||||||
|
|
||||||
$('body').html2canvas({
|
|
||||||
logging:true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
div { font: 12px Arial; }
|
div { font: 12px Arial; }
|
||||||
|
Loading…
Reference in New Issue
Block a user