Skip to content

Commit

Permalink
Add visual integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpap committed May 15, 2024
1 parent aa310bb commit 5c8f4b6
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Figure bbox=[0, 0, 400, 200]
Canvas bbox=[0, 0, 400, 200]
CartesianFrame bbox=[29, 5, 366, 173]
LinearAxis bbox=[29, 178, 366, 22]
LinearAxis bbox=[0, 5, 29, 173]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Figure bbox=[0, 0, 400, 200]
Canvas bbox=[0, 0, 400, 200]
CartesianFrame bbox=[29, 5, 366, 173]
LinearAxis bbox=[29, 178, 366, 22]
LinearAxis bbox=[0, 5, 29, 173]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Figure bbox=[0, 0, 400, 200]
Canvas bbox=[0, 0, 400, 200]
CartesianFrame bbox=[29, 5, 366, 173]
LinearAxis bbox=[29, 178, 366, 22]
LinearAxis bbox=[0, 5, 29, 173]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions bokehjs/test/integration/tools/range_tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import {display, fig} from "../_util"
import {PlotActions, xy} from "../../interactive"

import {PanTool, RangeTool, Range1d} from "@bokehjs/models"

describe("RangeTool", () => {
it("should support select_gesture='none'", async () => {
const x_range = new Range1d({start: 4, end: 8})

const pan_tool = new PanTool()
const range_tool = new RangeTool({x_range, select_gesture: "none"})

const p = fig([400, 200], {
x_range: [0, 10],
y_range: [0, 2],
tools: [pan_tool, range_tool],
})

const {view} = await display(p)
const actions = new PlotActions(view)
await actions.pan(xy(2, 1), xy(4, 1), 2)
await view.ready
})

it("should support select_gesture='pan'", async () => {
const x_range = new Range1d({start: 4, end: 8})

const pan_tool = new PanTool()
const range_tool = new RangeTool({x_range, select_gesture: "pan"})

const p = fig([400, 200], {
x_range: [0, 10],
y_range: [0, 2],
tools: [pan_tool, range_tool],
active_drag: range_tool,
})

const {view} = await display(p)
const actions = new PlotActions(view)
await actions.pan(xy(2, 1), xy(4, 1), 2)
await view.ready
})

it("should support select_gesture='tap'", async () => {
const x_range = new Range1d({start: 4, end: 8})

const pan_tool = new PanTool()
const range_tool = new RangeTool({x_range, select_gesture: "tap"})

const p = fig([400, 200], {
x_range: [0, 10],
y_range: [0, 2],
tools: [pan_tool, range_tool],
})

const {view} = await display(p)
const actions = new PlotActions(view)
await actions.tap(xy(2, 1))
await actions.hover(xy(2, 1), xy(4, 1), 2)
await actions.tap(xy(4, 1))
await actions.hover(xy(4, 1), xy(6, 1), 2)
await view.ready
})
})

0 comments on commit 5c8f4b6

Please sign in to comment.