(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestDocsFormatFlagsBuildRequestsCode(t *testing.T) { |
| 79 | t.Parallel() |
| 80 | |
| 81 | reqs, err := (DocsFormatFlags{Code: true}).buildRequests(3, 9, "t.second") |
| 82 | if err != nil { |
| 83 | t.Fatalf("buildRequests: %v", err) |
| 84 | } |
| 85 | if len(reqs) != 1 { |
| 86 | t.Fatalf("expected text request, got %d", len(reqs)) |
| 87 | } |
| 88 | textReq := reqs[0].UpdateTextStyle |
| 89 | if textReq == nil { |
| 90 | t.Fatalf("missing text request: %#v", reqs[0]) |
| 91 | } |
| 92 | if textReq.Fields != "weightedFontFamily,backgroundColor" { |
| 93 | t.Fatalf("unexpected text fields: %q", textReq.Fields) |
| 94 | } |
| 95 | style := textReq.TextStyle |
| 96 | if style.WeightedFontFamily == nil || style.WeightedFontFamily.FontFamily != "Courier New" { |
| 97 | t.Fatalf("unexpected code font: %#v", style.WeightedFontFamily) |
| 98 | } |
| 99 | rgb := style.BackgroundColor.Color.RgbColor |
| 100 | if rgb.Red != codeBackgroundGrey || rgb.Green != codeBackgroundGrey || rgb.Blue != codeBackgroundGrey { |
| 101 | t.Fatalf("unexpected code background: %#v", rgb) |
| 102 | } |
| 103 | if got := textReq.Range; got.StartIndex != 3 || got.EndIndex != 9 || got.TabId != "t.second" { |
| 104 | t.Fatalf("unexpected text range: %#v", got) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func TestDocsFormatFlagsValidation(t *testing.T) { |
| 109 | t.Parallel() |
nothing calls this directly
no test coverage detected