1 // Copyright (C) 2016 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
15 using System.Collections.Generic;
\r
16 using System.Windows.Forms;
\r
17 using ExpressionToCodeLib;
\r
18 using Microsoft.VisualStudio.TestTools.UnitTesting;
\r
20 namespace KancolleSniffer.Test
\r
23 public class ShipLabelTest
\r
26 /// 明石タイマー表示中の艦娘の名前を縮める
\r
29 public void TrancateNameForAkashiTimer()
\r
31 var dict = new Dictionary<string, string>
\r
36 {"Bismarck改", "Bismarck"},
\r
37 {"Bismarck twei", "Bismarck"},
\r
38 {"Bismarck drei", "Bismarck"},
\r
39 {"Prinz Eugen", "Prinz Eug"},
\r
40 {"Prinz Eugen改", "Prinz Eug"},
\r
41 {"Graf Zeppelin", "Graf Zep"},
\r
42 {"Graf Zeppelin改", "Graf Zep"},
\r
43 {"Libeccio改", "Libeccio"},
\r
45 var label = new ShipLabel {Parent = new Panel()};
\r
46 foreach (var entry in dict)
\r
48 label.SetName("", entry.Key, "", ShipNameWidth.AkashiTimer);
\r
49 PAssert.That(() => label.Text == entry.Value, entry.Key);
\r
57 public void TrancateNameForNDock()
\r
59 var dict = new Dictionary<string, string>
\r
62 {"Graf Zeppelin", "Graf Zeppeli"},
\r
63 {"Graf Zeppelin改", "Graf Zeppeli"},
\r
66 var label = new ShipLabel {Parent = new Panel()};
\r
67 foreach (var entry in dict)
\r
69 label.SetName("", entry.Key, "", ShipNameWidth.NDock);
\r
70 PAssert.That(() => label.Text == entry.Value, entry.Key);
\r
75 /// 一覧ウィンドウの要修復一覧の艦娘の名前を縮める
\r
78 public void TrancateNameForRepairList()
\r
80 var dict = new Dictionary<string, string>
\r
82 {"Graf Zeppelin", "Graf Zeppelin"},
\r
83 {"Graf Zeppelin改", "Graf Zeppelin"},
\r
86 var label = new ShipLabel {Parent = new Panel()};
\r
87 foreach (var entry in dict)
\r
89 label.SetName("", entry.Key, "", ShipNameWidth.RepairListFull);
\r
90 PAssert.That(() => label.Text == entry.Value, entry.Key);
\r
95 /// prefixとsuffixを加える
\r
98 public void SetName()
\r
100 var label = new ShipLabel {Parent= new Panel()};
\r
101 label.SetName("[避]", "綾波改二", "▫");
\r
102 PAssert.That(() => label.Text == "[避]綾波改二▫");
\r
103 label.SetName("[避]", "朝潮改二丁", "▫", ShipNameWidth.AkashiTimer);
\r
104 PAssert.That(() => label.Text == "[避]朝潮改二▫");
\r