Render display math environments in rich mode
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
_ "image/png"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@@ -123,8 +121,8 @@ func TestRenderIntegration(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("decode thumbnail size: %v", err)
|
||||
}
|
||||
if thumbWidth != inlineThumbnailSide || thumbHeight != inlineThumbnailSide {
|
||||
t.Errorf("thumbnail is %dx%d, want a %dx%d padded square", thumbWidth, thumbHeight, inlineThumbnailSide, inlineThumbnailSide)
|
||||
if thumbWidth > inlineThumbnailSide || thumbHeight > inlineThumbnailSide {
|
||||
t.Errorf("thumbnail is %dx%d, want no side beyond %d", thumbWidth, thumbHeight, inlineThumbnailSide)
|
||||
}
|
||||
|
||||
linked, err := r.Render(ctx, "", `\hypertarget{details}{Details}\par\hyperlink{details}{Go to details}`, 150)
|
||||
@@ -136,29 +134,6 @@ func TestRenderIntegration(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSquareThumbnailPadsWithoutStretching(t *testing.T) {
|
||||
source := image.NewRGBA(image.Rect(0, 0, 160, 80))
|
||||
draw.Draw(source, source.Bounds(), image.NewUniform(color.Black), image.Point{}, draw.Src)
|
||||
|
||||
thumbnail := squareThumbnail(source)
|
||||
if thumbnail.Bounds() != image.Rect(0, 0, inlineThumbnailSide, inlineThumbnailSide) {
|
||||
t.Fatalf("thumbnail bounds = %v", thumbnail.Bounds())
|
||||
}
|
||||
for _, sample := range []struct {
|
||||
point image.Point
|
||||
want color.RGBA
|
||||
}{
|
||||
{image.Pt(160, 119), color.RGBA{255, 255, 255, 255}},
|
||||
{image.Pt(160, 120), color.RGBA{0, 0, 0, 255}},
|
||||
{image.Pt(79, 160), color.RGBA{255, 255, 255, 255}},
|
||||
{image.Pt(80, 160), color.RGBA{0, 0, 0, 255}},
|
||||
} {
|
||||
if got := thumbnail.RGBAAt(sample.point.X, sample.point.Y); got != sample.want {
|
||||
t.Errorf("pixel at %v = %v, want %v", sample.point, got, sample.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func pngSizeBytes(data []byte) (int, int, error) {
|
||||
return imageSizeBytes(data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user