開発に使用するリポジトリ
Revisión | e6ace1727f5fa1c310b049c204c9c0fed7fd922b (tree) |
---|---|
Tiempo | 2013-01-13 01:15:13 |
Autor | Kimura Youichi <kim.upsilon@bucy...> |
Commiter | Kimura Youichi |
TweetThumbnail.ScrollUp/ScrollDownメソッドが正しく機能していないバグを修正
@@ -238,5 +238,50 @@ namespace OpenTween | ||
238 | 238 | Assert.That(eventCalled, Is.True); |
239 | 239 | } |
240 | 240 | } |
241 | + | |
242 | + [Test] | |
243 | + public void ScrollTest() | |
244 | + { | |
245 | + var post = new PostClass | |
246 | + { | |
247 | + TextFromApi = "てすと http://foo.example.com/abcd http://foo.example.com/efgh", | |
248 | + Media = new Dictionary<string, string> | |
249 | + { | |
250 | + {"http://foo.example.com/abcd", "http://foo.example.com/abcd"}, | |
251 | + {"http://foo.example.com/efgh", "http://foo.example.com/efgh"}, | |
252 | + }, | |
253 | + }; | |
254 | + | |
255 | + using (var thumbbox = new TweetThumbnail()) | |
256 | + { | |
257 | + SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); | |
258 | + thumbbox.ShowThumbnailAsync(post).Wait(); | |
259 | + | |
260 | + Assert.That(thumbbox.scrollBar.Minimum, Is.EqualTo(0)); | |
261 | + Assert.That(thumbbox.scrollBar.Maximum, Is.EqualTo(1)); | |
262 | + | |
263 | + thumbbox.scrollBar.Value = 0; | |
264 | + | |
265 | + thumbbox.ScrollUp(); | |
266 | + Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(1)); | |
267 | + Assert.That(thumbbox.pictureBox[0].Visible, Is.False); | |
268 | + Assert.That(thumbbox.pictureBox[1].Visible, Is.True); | |
269 | + | |
270 | + thumbbox.ScrollUp(); | |
271 | + Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(1)); | |
272 | + Assert.That(thumbbox.pictureBox[0].Visible, Is.False); | |
273 | + Assert.That(thumbbox.pictureBox[1].Visible, Is.True); | |
274 | + | |
275 | + thumbbox.ScrollDown(); | |
276 | + Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(0)); | |
277 | + Assert.That(thumbbox.pictureBox[0].Visible, Is.True); | |
278 | + Assert.That(thumbbox.pictureBox[1].Visible, Is.False); | |
279 | + | |
280 | + thumbbox.ScrollDown(); | |
281 | + Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(0)); | |
282 | + Assert.That(thumbbox.pictureBox[0].Visible, Is.True); | |
283 | + Assert.That(thumbbox.pictureBox[1].Visible, Is.False); | |
284 | + } | |
285 | + } | |
241 | 286 | } |
242 | 287 | } |
@@ -42,7 +42,7 @@ | ||
42 | 42 | this.scrollBar.Name = "scrollBar"; |
43 | 43 | this.scrollBar.Size = new System.Drawing.Size(17, 188); |
44 | 44 | this.scrollBar.TabIndex = 0; |
45 | - this.scrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.scrollBar_Scroll); | |
45 | + this.scrollBar.ValueChanged += new System.EventHandler(this.scrollBar_ValueChanged); | |
46 | 46 | // |
47 | 47 | // TweetThumbnail |
48 | 48 | // |
@@ -188,12 +188,17 @@ namespace OpenTween | ||
188 | 188 | this.scrollBar.Value = newval; |
189 | 189 | } |
190 | 190 | |
191 | - private void scrollBar_Scroll(object sender, ScrollEventArgs e) | |
191 | + private void scrollBar_ValueChanged(object sender, EventArgs e) | |
192 | 192 | { |
193 | - if (e.NewValue == e.OldValue) return; | |
193 | + for (var i = 0; i < this.pictureBox.Count; i++) | |
194 | + { | |
195 | + var picbox = this.pictureBox[i]; | |
194 | 196 | |
195 | - this.pictureBox[e.NewValue].Visible = true; | |
196 | - this.pictureBox[e.OldValue].Visible = false; | |
197 | + if (this.scrollBar.Value == i) | |
198 | + picbox.Visible = true; | |
199 | + else | |
200 | + picbox.Visible = false; | |
201 | + } | |
197 | 202 | } |
198 | 203 | |
199 | 204 | private void pictureBox_DoubleClick(object sender, EventArgs e) |