Skip to content

Commit f87777a

Browse files
committed
Add tests for fractional infoview dimensions.
Refs: #406 (comment)
1 parent 4a4d5e5 commit f87777a

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---@brief [[
2+
--- Tests for infoview horizontal layout with fractional height.
3+
---@brief ]]
4+
5+
local infoview = require 'lean.infoview'
6+
7+
-- Emulate a 80x24 landscape display.
8+
vim.o.columns = 80
9+
vim.o.lines = 24
10+
11+
require('lean').setup {
12+
infoview = {
13+
autoopen = false,
14+
orientation = 'horizontal',
15+
height = 0.5,
16+
},
17+
}
18+
19+
describe('infoview window fractional horizontal', function()
20+
it('opens with fractional height', function()
21+
infoview.open()
22+
local height = infoview.get_current_infoview().window:height()
23+
assert.is.equal(24 / 2, height)
24+
end)
25+
end)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---@brief [[
2+
--- Tests for infoview vertical layout with fractional width.
3+
---@brief ]]
4+
5+
local infoview = require 'lean.infoview'
6+
7+
-- Emulate a 80x24 portrait display.
8+
vim.o.columns = 80
9+
vim.o.lines = 24
10+
11+
require('lean').setup {
12+
infoview = {
13+
autoopen = false,
14+
orientation = 'vertical',
15+
width = 1 / 2,
16+
},
17+
}
18+
19+
describe('infoview window fractional vertical', function()
20+
it('opens with fractional width', function()
21+
infoview.open()
22+
local width = infoview.get_current_infoview().window:width()
23+
assert.is.equal(80 / 2, width)
24+
end)
25+
end)

0 commit comments

Comments
 (0)