ref: 3662834cbb526bcf9617b3221892d38a4d58deb7
parent: d61b126cf6eb12fa51c0ccb4d12114d524c7a9f8
author: Philip Silva <philip.silva@protonmail.com>
date: Sat Jan 22 09:15:17 EST 2022
Add short tests
--- a/browser/browser_test.go
+++ b/browser/browser_test.go
@@ -151,9 +151,6 @@
}
}
-func TestNilPanic(t *testing.T) {
-}
-
func TestNodeToBoxNoscript(t *testing.T) {
enable := true
EnableNoScriptTag = enable
--- a/browser/duitx/grid_test.go
+++ b/browser/duitx/grid_test.go
@@ -46,6 +46,9 @@
}
func TestMaxWidths(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test in short mode.")
+ }
opts := &duit.DUIOpts{
Dimensions: "400x300",
}
--- a/browser/duitx/scroll_test.go
+++ b/browser/duitx/scroll_test.go
@@ -9,6 +9,9 @@
)
func TestFreeCur(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test in short mode.")
+ }
ui := &Scroll{
r: image.Rectangle{
Min: image.Point{0, 0},
--- a/browser/experimental.go
+++ b/browser/experimental.go
@@ -1,92 +1,10 @@
package browser
import (
- "9fans.net/go/draw"
"fmt"
- "github.com/mjl-/duit"
- "github.com/psilva261/opossum/browser/duitx"
"github.com/psilva261/opossum/js"
"github.com/psilva261/opossum/logger"
- "image"
)
-
-type AtomBox struct {
- Left, Right, Bottom, Top int
-}
-
-// Atom is div/span with contentEditable=true/false, i.e. it should be able
-// to render practically anything
-type Atom struct {
- // BackgroundImgSrc to read image from provided cache
- // it's okay when the pointer is empty -> defered loading
- BackgroundImgSrc string
- BackgroundColor draw.Color
- BorderWidths AtomBox
- Color draw.Color
- Margin AtomBox
- Padding AtomBox
- Wrap bool
-
- // Children []*Atom TODO: future; at the same time rething where
- // to put Draw functions etc./if to rely on
- // type Kid
- Text string // Text to draw, wrapped at glyph boundary.
- Font *draw.Font `json:"-"` // For drawing text.
- Click func()
-
- lines []string
- size image.Point
- m draw.Mouse
-}
-
-func (ui *Atom) font(dui *duit.DUI) *draw.Font {
- return dui.Font(ui.Font)
-}
-
-func (ui *Atom) Draw(dui *duit.DUI, self *duit.Kid, img *draw.Image, orig image.Point, m draw.Mouse, force bool) {
- // dui.debugDraw(self)
-
- p := orig
- font := ui.font(dui)
- for _, line := range ui.lines {
- img.String(p, dui.Regular.Normal.Text, image.ZP, font, line)
- p.Y += font.Height
- }
-}
-
-func isLeaf(ui duit.UI) bool {
- if ui == nil {
- return true
- }
- switch /*v := */ ui.(type) {
- case nil:
- return true
- case *duit.Scroll:
- return false
- case *duit.Box:
- return false
- case *Element:
- return false
- case *duitx.Grid:
- return false
- case *duit.Image:
- return true
- case *duit.Label:
- return true
- case *Label:
- return false
- case *duit.Button:
- return true
- case *Image:
- return false
- case *duit.Field:
- return true
- case *CodeView:
- return false
- default:
- return false
- }
-}
func processJS2() (resHtm string, changed bool, err error) {
resHtm, changed, err = js.Start()
--- a/browser/experimental_test.go
+++ b/browser/experimental_test.go
@@ -16,10 +16,10 @@
go fs.Srv9p()
}
-func TestAtom(t *testing.T) {
-}
-
func TestProcessJS2SkipFailure(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test in short mode.")
+ }
h := `
<html>
<body>
--- a/js/js_test.go
+++ b/js/js_test.go
@@ -25,6 +25,9 @@
}
func TestJQueryHide(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test in short mode.")
+ }
buf, err := ioutil.ReadFile("jquery-3.5.1.js")
if err != nil {
t.Fatalf("%v", err)
--- a/style/css.go
+++ b/style/css.go
@@ -103,7 +103,6 @@
} else {
return s, fmt.Errorf("next: %v", err)
}
- break
case css.QualifiedRuleGrammar:
sel := Selector{}
for _, val := range p.Values() {
--- a/style/stylesheets.go
+++ b/style/stylesheets.go
@@ -748,7 +748,6 @@
} else {
return p.Style().baseWidth()
}
- return 0
}
func (cs Map) Css(propName string) string {