Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Five-菜鸟级
echarts
提交
0d972e02
E
echarts
项目概览
Five-菜鸟级
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d972e02
编写于
5月 08, 2021
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(visual): fix progressive rendering in VST
上级
b5d46d79
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
19 deletion
+43
-19
test/lib/frameInsight.js
test/lib/frameInsight.js
+11
-6
test/runTest/cli.js
test/runTest/cli.js
+1
-1
test/runTest/client/client.js
test/runTest/client/client.js
+1
-1
test/runTest/runtime/timeline.js
test/runTest/runtime/timeline.js
+10
-2
test/runTest/util.js
test/runTest/util.js
+18
-8
test/stream-basic.js
test/stream-basic.js
+1
-0
test/stream-basic1.html
test/stream-basic1.html
+1
-1
未找到文件。
test/lib/frameInsight.js
浏览文件 @
0d972e02
...
...
@@ -43,12 +43,17 @@
addEventListener
:
global
.
addEventListener
};
var
now
=
global
.
performance
// performance.now has higer accuracy.
?
performance
.
now
.
bind
(
performance
)
:
function
()
{
return
+
new
Date
();
};
// var now = global.performance
// // performance.now has higer accuracy.
// ? performance.now.bind(performance)
// : function () {
// return +new Date();
// };
// performance.now is not mocked in the visual regression test. Always use Date.now
var
now
=
function
()
{
return
Date
.
now
();
};
instrumentBase
();
...
...
test/runTest/cli.js
浏览文件 @
0d972e02
...
...
@@ -24,7 +24,7 @@ const fs = require('fs');
const
path
=
require
(
'
path
'
);
const
program
=
require
(
'
commander
'
);
const
compareScreenshot
=
require
(
'
./compareScreenshot
'
);
const
{
testNameFromFile
,
fileNameFromTest
,
getVersionDir
,
buildRuntimeCode
,
getEChartsTestFileName
,
waitTime
}
=
require
(
'
./util
'
);
const
{
testNameFromFile
,
fileNameFromTest
,
getVersionDir
,
buildRuntimeCode
,
getEChartsTestFileName
}
=
require
(
'
./util
'
);
const
{
origin
}
=
require
(
'
./config
'
);
const
cwebpBin
=
require
(
'
cwebp-bin
'
);
const
{
execFile
}
=
require
(
'
child_process
'
);
...
...
test/runTest/client/client.js
浏览文件 @
0d972e02
...
...
@@ -419,7 +419,7 @@ function runTests(tests, noHeadless) {
threads
:
app
.
runConfig
.
threads
,
renderer
:
app
.
runConfig
.
renderer
,
noHeadless
,
replaySpeed
:
noHeadless
?
2
:
5
replaySpeed
:
noHeadless
?
5
:
5
});
}
...
...
test/runTest/runtime/timeline.js
浏览文件 @
0d972e02
...
...
@@ -131,8 +131,15 @@ function flushIntervalHandlers() {
const
NativeDate
=
window
.
Date
;
const
mockNow
=
function
()
{
// // Use same time in one frame.
// var realFrameTime = NativeDate.now();
// // Split frame. Add 8ms offset on the second half
// // Avoid infinite loop when some logic determine whether to break the loop based on the execution time.
// // For example https://github.com/apache/echarts/blob/737e23c0054e6b501ecc6f562920cffae953b5c6/src/core/echarts.ts#L537
// var frameDeltaTime = realFrameTime - realFrameStartTime;
var
frameDeltaTime
=
0
;
// Use same time in one frame.
return
TIMELINE_START
+
timelineTime
*
window
.
__VST_PLAYBACK_SPEED__
;
return
TIMELINE_START
+
(
timelineTime
+
frameDeltaTime
)
*
window
.
__VST_PLAYBACK_SPEED__
;
};
function
MockDate
(...
args
)
{
if
(
!
args
.
length
)
{
...
...
@@ -145,9 +152,10 @@ function MockDate(...args) {
MockDate
.
prototype
=
Object
.
create
(
NativeDate
.
prototype
);
Object
.
setPrototypeOf
(
MockDate
,
NativeDate
);
MockDate
.
now
=
mockNow
;
window
.
Date
=
MockDate
;
// TODO Do we need to mock performance? Or leave some API that can keep real.
export
function
start
()
{
window
.
__VST_TIMELINE_PAUSED__
=
false
;
...
...
test/runTest/util.js
浏览文件 @
0d972e02
...
...
@@ -27,7 +27,11 @@ const commonjs = require('@rollup/plugin-commonjs');
const
config
=
require
(
'
./config
'
);
function
modifyEChartsCode
(
code
)
{
return
code
.
replace
(
/Math.random/g
,
'
__random__inner__
'
);
return
code
.
replace
(
/Math
\.
random/g
,
'
__random__inner__
'
)
// https://github.com/apache/echarts/blob/737e23c0054e6b501ecc6f562920cffae953b5c6/src/core/echarts.ts#L537
// This code will cause infinite loop if we reduce the precision of Date in the visual regression test.
// TODO: This is a very dirty HACK.
.
replace
(
'
remainTime > 0
'
,
'
false
'
);
}
module
.
exports
.
testNameFromFile
=
function
(
fileName
)
{
...
...
@@ -53,20 +57,22 @@ module.exports.getEChartsTestFileName = function () {
};
module
.
exports
.
prepareEChartsLib
=
function
(
version
)
{
let
versionFolder
=
path
.
join
(
__dirname
,
getVersionDir
(
version
));
const
versionFolder
=
path
.
join
(
__dirname
,
getVersionDir
(
version
));
const
ecDownloadPath
=
`
${
versionFolder
}
/echarts.js`
;
fse
.
ensureDirSync
(
versionFolder
);
if
(
!
version
||
version
===
'
local
'
)
{
// Developing version, make sure it's new build
fse
.
copySync
(
path
.
join
(
__dirname
,
'
../../dist/echarts.js
'
),
`
${
versionFolder
}
/echarts.js`
);
let
code
=
modifyEChartsCode
(
fs
.
readFileSync
(
`
${
versionFolder
}
/echarts.js`
,
'
utf-8
'
));
let
code
=
modifyEChartsCode
(
fs
.
readFileSync
(
ecDownloadPath
,
'
utf-8
'
));
fs
.
writeFileSync
(
`
${
versionFolder
}
/
${
module
.
exports
.
getEChartsTestFileName
()}
`
,
code
,
'
utf-8
'
);
return
Promise
.
resolve
();
return
Promise
.
resolve
();
}
return
new
Promise
(
resolve
=>
{
le
t
testLibPath
=
`
${
versionFolder
}
/
${
module
.
exports
.
getEChartsTestFileName
()}
`
;
if
(
!
fs
.
existsSync
(
testLib
Path
))
{
const
file
=
fs
.
createWriteStream
(
`
${
versionFolder
}
/echarts.js`
);
cons
t
testLibPath
=
`
${
versionFolder
}
/
${
module
.
exports
.
getEChartsTestFileName
()}
`
;
if
(
!
fs
.
existsSync
(
ecDownload
Path
))
{
const
file
=
fs
.
createWriteStream
();
const
isNightly
=
version
.
includes
(
'
-dev
'
);
const
packageName
=
isNightly
?
'
echarts-nightly
'
:
'
echarts
'
...
...
@@ -75,13 +81,17 @@ module.exports.prepareEChartsLib = function (version) {
response
.
pipe
(
file
);
file
.
on
(
'
finish
'
,
()
=>
{
let
code
=
modifyEChartsCode
(
fs
.
readFileSync
(
`
${
versionFolder
}
/echarts.js`
,
'
utf-8
'
));
let
code
=
modifyEChartsCode
(
fs
.
readFileSync
(
ecDownloadPath
,
'
utf-8
'
));
fs
.
writeFileSync
(
testLibPath
,
code
,
'
utf-8
'
);
resolve
();
});
});
}
else
{
// Always do code modifaction.
// In case we need to do replacement on old downloads.
let
code
=
modifyEChartsCode
(
fs
.
readFileSync
(
ecDownloadPath
,
'
utf-8
'
));
fs
.
writeFileSync
(
testLibPath
,
code
,
'
utf-8
'
);
resolve
();
}
});
...
...
test/stream-basic.js
浏览文件 @
0d972e02
...
...
@@ -23,6 +23,7 @@
var
_recordContainer
;
var
CELL_MAX
=
160
;
if
(
window
.
Canteen
)
{
window
.
Canteen
.
globals
.
STACK_SIZE
=
100000000
;
}
...
...
test/stream-basic1.html
浏览文件 @
0d972e02
...
...
@@ -55,7 +55,7 @@ under the License.
var
count
=
5000
;
var
lineCount
=
100
;
var
progressive
=
5
0
;
var
progressive
=
10
0
;
var
data
=
[];
var
yCurr
=
5
;
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录