Assert.That(eventCalled, Is.True);
}
}
+
+ [Test]
+ public void ScrollTest()
+ {
+ var post = new PostClass
+ {
+ TextFromApi = "てすと http://foo.example.com/abcd http://foo.example.com/efgh",
+ Media = new Dictionary<string, string>
+ {
+ {"http://foo.example.com/abcd", "http://foo.example.com/abcd"},
+ {"http://foo.example.com/efgh", "http://foo.example.com/efgh"},
+ },
+ };
+
+ using (var thumbbox = new TweetThumbnail())
+ {
+ SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
+ thumbbox.ShowThumbnailAsync(post).Wait();
+
+ Assert.That(thumbbox.scrollBar.Minimum, Is.EqualTo(0));
+ Assert.That(thumbbox.scrollBar.Maximum, Is.EqualTo(1));
+
+ thumbbox.scrollBar.Value = 0;
+
+ thumbbox.ScrollUp();
+ Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(1));
+ Assert.That(thumbbox.pictureBox[0].Visible, Is.False);
+ Assert.That(thumbbox.pictureBox[1].Visible, Is.True);
+
+ thumbbox.ScrollUp();
+ Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(1));
+ Assert.That(thumbbox.pictureBox[0].Visible, Is.False);
+ Assert.That(thumbbox.pictureBox[1].Visible, Is.True);
+
+ thumbbox.ScrollDown();
+ Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(0));
+ Assert.That(thumbbox.pictureBox[0].Visible, Is.True);
+ Assert.That(thumbbox.pictureBox[1].Visible, Is.False);
+
+ thumbbox.ScrollDown();
+ Assert.That(thumbbox.scrollBar.Value, Is.EqualTo(0));
+ Assert.That(thumbbox.pictureBox[0].Visible, Is.True);
+ Assert.That(thumbbox.pictureBox[1].Visible, Is.False);
+ }
+ }
}
}
this.scrollBar.Value = newval;
}
- private void scrollBar_Scroll(object sender, ScrollEventArgs e)
+ private void scrollBar_ValueChanged(object sender, EventArgs e)
{
- if (e.NewValue == e.OldValue) return;
+ for (var i = 0; i < this.pictureBox.Count; i++)
+ {
+ var picbox = this.pictureBox[i];
- this.pictureBox[e.NewValue].Visible = true;
- this.pictureBox[e.OldValue].Visible = false;
+ if (this.scrollBar.Value == i)
+ picbox.Visible = true;
+ else
+ picbox.Visible = false;
+ }
}
private void pictureBox_DoubleClick(object sender, EventArgs e)