~dricottone/image2ascii

ref: 8637a99070ce5e773b9b3c42ef00b6d18a48eb14 image2ascii/terminal/terminal_test.go -rw-r--r-- 681 bytes
8637a990 — qeesung add some examples 6 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package terminal

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestNewTerminalAccessor(t *testing.T) {
	assertions := assert.New(t)
	accessor := NewTerminalAccessor()
	assertions.True(accessor != nil)
}

func TestAccessor_CharWidth(t *testing.T) {
	assertions := assert.New(t)
	accessor := NewTerminalAccessor()
	charWidth := accessor.CharWidth()
	if accessor.IsWindows() {
		assertions.Equal(charWidthWindows, charWidth)
	} else {
		assertions.Equal(charWidthOther, charWidth)
	}
}

func TestAccessor_ScreenSize(t *testing.T) {
	assertions := assert.New(t)
	accessor := NewTerminalAccessor()
	_, _, err := accessor.ScreenSize()
	assertions.True(err != nil)
}