-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(g-canvas): strokeText should be invoked before fillText for Text, c…
…lose #298
- Loading branch information
1 parent
0563ee2
commit c3ad285
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const expect = require('chai').expect; | ||
import Canvas from '../../src/canvas'; | ||
import { getTextColorCount } from '../get-color'; | ||
|
||
const dom = document.createElement('div'); | ||
document.body.appendChild(dom); | ||
dom.id = 'c1'; | ||
|
||
describe('#298', () => { | ||
const canvas = new Canvas({ | ||
container: dom, | ||
width: 600, | ||
height: 600, | ||
pixelRatio: 1, | ||
}); | ||
const context = canvas.get('context'); | ||
|
||
it('strokeText should be invoked before fillText for text', (done) => { | ||
canvas.addShape('text', { | ||
attrs: { | ||
x: 10, | ||
y: 100, | ||
text: 'G 4.0 的文本效果', | ||
fill: 'blue', | ||
stroke: 'red', | ||
lineWidth: 5, | ||
fontSize: 20, | ||
textBaseline: 'top', | ||
}, | ||
}); | ||
setTimeout(() => { | ||
expect(getTextColorCount(context, 10, 110, 20, '#ff0000') > 0).eqls(true); | ||
expect(getTextColorCount(context, 10, 110, 20, '#0000ff') > 0).eqls(true); | ||
done(); | ||
}, 25); | ||
}); | ||
}); |