OSDN Git Service

対応表ではなく横幅を指定して艦娘の名前を縮める
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer.Test / ShipLabelTest.cs
1 // Copyright (C) 2016 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
2 //\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
6 //\r
7 //    http://www.apache.org/licenses/LICENSE-2.0\r
8 //\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
14 \r
15 using System.Collections.Generic;\r
16 using System.Windows.Forms;\r
17 using ExpressionToCodeLib;\r
18 using Microsoft.VisualStudio.TestTools.UnitTesting;\r
19 \r
20 namespace KancolleSniffer.Test\r
21 {\r
22     [TestClass]\r
23     public class ShipLabelTest\r
24     {\r
25         /// <summary>\r
26         /// 明石タイマー表示中の艦娘の名前を縮める\r
27         /// </summary>\r
28         [TestMethod]\r
29         public void TrancateNameForAkashiTimer()\r
30         {\r
31             var dict = new Dictionary<string, string>\r
32             {\r
33                 {"夕立改二", "夕立改二"},\r
34                 {"千代田航改", "千代田航"},\r
35                 {"千代田航改二", "千代田航"},\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
44             };\r
45             var label = new ShipLabel {Parent = new Panel()};\r
46             foreach (var entry in dict)\r
47             {\r
48                 label.SetName("", entry.Key, "", ShipNameWidth.AkashiTimer);\r
49                 PAssert.That(() => label.Text == entry.Value, entry.Key);\r
50             }\r
51         }\r
52 \r
53         /// <summary>\r
54         /// 入渠中の艦娘名の名前を縮める\r
55         /// </summary>\r
56         [TestMethod]\r
57         public void TrancateNameForNDock()\r
58         {\r
59             var dict = new Dictionary<string, string>\r
60             {\r
61                 {"千歳航改二", "千歳航改二"},\r
62                 {"Graf Zeppelin", "Graf Zeppeli"},\r
63                 {"Graf Zeppelin改", "Graf Zeppeli"},\r
64                 {"千代田航改二", "千代田航改"}\r
65             };\r
66             var label = new ShipLabel {Parent = new Panel()};\r
67             foreach (var entry in dict)\r
68             {\r
69                 label.SetName("", entry.Key, "", ShipNameWidth.NDock);\r
70                 PAssert.That(() => label.Text == entry.Value, entry.Key);\r
71             }\r
72         }\r
73 \r
74         /// <summary>\r
75         /// 一覧ウィンドウの要修復一覧の艦娘の名前を縮める\r
76         /// </summary>\r
77         [TestMethod]\r
78         public void TrancateNameForRepairList()\r
79         {\r
80             var dict = new Dictionary<string, string>\r
81             {\r
82                 {"Graf Zeppelin", "Graf Zeppelin"},\r
83                 {"Graf Zeppelin改", "Graf Zeppelin"},\r
84                 {"千代田航改二", "千代田航改"}\r
85             };\r
86             var label = new ShipLabel {Parent = new Panel()};\r
87             foreach (var entry in dict)\r
88             {\r
89                 label.SetName("", entry.Key, "", ShipNameWidth.RepairListFull);\r
90                 PAssert.That(() => label.Text == entry.Value, entry.Key);\r
91             }\r
92         }\r
93 \r
94         /// <summary>\r
95         /// prefixとsuffixを加える\r
96         /// </summary>\r
97         [TestMethod]\r
98         public void SetName()\r
99         {\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
105         }\r
106     }\r
107 }