Browse Source

Misc refactoring

v1.x
Tj Holowaychuk 14 years ago
parent
commit
9b55a191b7
  1. 7
      Makefile
  2. 3
      src/CanvasRenderingContext2d.cc
  3. 19
      test/public/tests.js

7
Makefile

@ -1,14 +1,15 @@
ADDON = build/default/canvas.node
build/default/canvas.node: src/*.cc
$(ADDON): src/*.cc
node-waf configure build
test: build/default/canvas.node
test: $(ADDON)
@./support/expresso/bin/expresso \
-I lib \
test/*.test.js
test-server:
test-server: $(ADDON)
@node test/server.js
benchmark:

3
src/CanvasRenderingContext2d.cc

@ -1102,6 +1102,9 @@ Context2d::setTextPath(const char *str, double x, double y) {
cairo_text_extents_t te;
cairo_text_extents(_context, str, &te);
cairo_font_extents_t fe;
cairo_font_extents(_context, &fe);
// Alignment
switch (state->textAlignment) {
// center

19
test/public/tests.js

@ -656,7 +656,7 @@ tests['textBaseline hanging'] = function(ctx){
ctx.fillText("hanging", 100, 100);
};
tests['textBaseline bottom'] = function(ctx){
tests['textBaseline middle'] = function(ctx){
ctx.strokeStyle = '#666';
ctx.strokeRect(0,0,200,200);
ctx.lineTo(0,100);
@ -664,9 +664,9 @@ tests['textBaseline bottom'] = function(ctx){
ctx.stroke();
ctx.font = 'normal 20px Arial';
ctx.textBaseline = 'bottom';
ctx.textBaseline = 'middle';
ctx.textAlign = 'center';
ctx.fillText("bottom", 100, 100);
ctx.fillText("middle", 100, 100);
};
tests['textBaseline ideographic'] = function(ctx){
@ -682,6 +682,19 @@ tests['textBaseline ideographic'] = function(ctx){
ctx.fillText("ideographic", 100, 100);
};
tests['textBaseline bottom'] = function(ctx){
ctx.strokeStyle = '#666';
ctx.strokeRect(0,0,200,200);
ctx.lineTo(0,100);
ctx.lineTo(200,100);
ctx.stroke();
ctx.font = 'normal 20px Arial';
ctx.textBaseline = 'bottom';
ctx.textAlign = 'center';
ctx.fillText("bottom", 100, 100);
};
tests['font size px'] = function(ctx){
ctx.strokeStyle = '#666';
ctx.strokeRect(0,0,200,200);

Loading…
Cancel
Save