~dricottone/image2ascii

ref: 90b8bfeeff7b1820630eec948e18b924e5a73f7a image2ascii/terminal/terminal_test.go -rw-r--r-- 681 bytes
90b8bfee — qeesung remove useless code 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)
}