-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog_test.go
30 lines (28 loc) · 2.97 KB
/
dialog_test.go
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 dosktop
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestPrintDialogWithTextStyles(test *testing.T) {
commonResource.isDebugEnabled = true
layerAlias1 := "Layer1"
layerWidth := 40
layerHeight := 10
textStyleAlias := "redColor"
InitializeTerminal(layerWidth, layerHeight)
AddLayer(layerAlias1, 0, 0, layerWidth, layerHeight, 1, "")
Layer(layerAlias1)
Color(4, 6)
FillLayer(layerAlias1, "a1a2a3a4a5")
Color(8, 9)
attributeEntry := NewTextStyle()
attributeEntry.ForegroundColor = GetRGBColor(255, 0 ,0)
AddTextStyle(textStyleAlias, attributeEntry)
stringToPrint := "This is a {redColor}sample{/} line of text. This line will {redColor}automatically{/} wrap without cutting words."
PrintDialog(layerAlias1, 2, 2, 20, 0, false, stringToPrint)
UpdateDisplay()
layerEntry := commonResource.screenLayer
obtainedValue := layerEntry.GetBasicAnsiStringAsBase64()
expectedValue := "G1szODsyOzA7MDsxMjhtG1s0ODsyOzA7MTI4OzEyOG1hMWEyYTNhNGE1YTFhMmEzYTRhNWExYTJhM2E0YTVhMWEyYTNhNGE1G1szODsyOzA7MDswbRtbNDg7MjswOzA7MG0KG1szODsyOzA7MDsxMjhtG1s0ODsyOzA7MTI4OzEyOG1hMWEyYTNhNGE1YTFhMmEzYTRhNWExYTJhM2E0YTVhMWEyYTNhNGE1G1szODsyOzA7MDswbRtbNDg7MjswOzA7MG0KG1szODsyOzA7MDsxMjhtG1s0ODsyOzA7MTI4OzEyOG1hMRtbMzg7MjsxMjg7MTI4OzEyOG0bWzQ4OzI7MjU1OzA7MG1UaGlzIGlzIGEgG1szODsyOzA7MDsxMjhtG1s0ODsyOzA7MTI4OzEyOG1hMmEzYTRhNWExYTJhM2E0YTVhMWEyYTNhNGE1G1szOD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U7MDswbXdpdGhvdXQgY3V0dGluZyAbWzM4OzI7MDswOzEyOG0bWzQ4OzI7MDsxMjg7MTI4bWE1YTFhMmEzYTRhNWExYTJhM2E0YTUbWzM4OzI7MDswOzBtG1s0ODsyOzA7MDswbQobWzM4OzI7MDswOzEyOG0bWzQ4OzI7MDsxMjg7MTI4bWExG1szODsyOzEyODsxMjg7MTI4bRtbNDg7MjsyNTU7MDswbXdvcmRzLhtbMzg7MjswOzA7MTI4bRtbNDg7MjswOzEyODsxMjhtYTVhMWEyYTNhNGE1YTFhMmEzYTRhNWExYTJhM2E0YTUbWzM4OzI7MDswOzBtG1s0ODsyOzA7MDswbQobWzM4OzI7MDswOzEyOG0bWzQ4OzI7MDsxMjg7MTI4bWExYTJhM2E0YTVhMWEyYTNhNGE1YTFhMmEzYTRhNWExYTJhM2E0YTUbWzM4OzI7MDswOzBtG1s0ODsyOzA7MDswbQo="
assert.Equalf(test, expectedValue, obtainedValue, "The updated screen does not match the master original!")
}