 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file. 1 package com.realtime.crossfire.jxclient.gui.log;
4 import org.jetbrains.annotations.NotNull;
5 import org.junit.Assert;
48 public void lineAdded() {
55 public void lineReplaced() {
62 public void linesRemoved(@NotNull
final List<Line> lines) {
95 public void checkState(
final int expectedTopIndex,
final int expectedTopOffset) {
96 final int expectedScrollPos = expectedTopIndex*
FONT_HEIGHT+expectedTopOffset;
100 Assert.assertEquals(
formatState(expectedTopIndex, expectedTopOffset, expectedScrollPos),
formatState(topIndex, topOffset, scrollPos));
111 private String
formatState(
final int topIndex,
final int topOffset,
final int scrollPos) {
Buffer getBuffer()
Returns the tested Buffer instance.
Interface for listeners for changes of Buffer contents.
static final int FONT_HEIGHT
The height of the font in pixels.
void scrollTo(final int y)
Calls RenderState#scrollTo(Buffer, int).
void linesReplaced(@NotNull final Buffer buffer)
Some lines have been replaced at the end of the buffer.
void linesAdded(@NotNull final Buffer buffer)
Some lines have been added to the buffer.
void addBufferListener(@NotNull final BufferListener listener)
Adds a listener to notify of changes.
String formatState(final int topIndex, final int topOffset, final int scrollPos)
Returns a text representation of the state.
static final int HEIGHT
Assumed height of log window.
void setHeight(@NotNull final Buffer buffer, final int h)
Sets the viewable height in pixel.
int getTopOffset()
Returns the number of pixels to shift the first displayed line.
void checkState(final int expectedTopIndex, final int expectedTopOffset)
Checks that the RenderState instance contains expected values.
Manages the contents of the contents of a log window.
RenderStateTestRec(final int maxLines)
Creates a new instance.
void scrollTo(@NotNull final Buffer buffer, final int y)
Scrolls to the given pixel location.
Encapsulates the state for a scroll bar.
int getTopIndex()
Returns the index of the first line to display.
void setShowTimestamps(final boolean showTimestamps)
Sets whether timestamps are shown.
final RenderState rs
The tested RenderState instance.
void linesRemoved(@NotNull final Buffer buffer, @NotNull final Collection< Line > lines)
Some lines have been removed from the buffer.
int getTotalHeight()
Returns the total height of all lines.
int getScrollPos()
Returns the location of the view area in pixels.
final Buffer buffer
The tested Buffer instance.
A Buffer implementation for tests.