~dricottone/image2ascii

ref: a03493e21bf601ce28a5450244d692a1de5ca2cb image2ascii/terminal/terminal_test.go -rw-r--r-- 681 bytes
a03493e2Dominic Ricottone Migrate from Dep to Go Modules 2 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)
}