summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2010-07-10Split the "terminal" interface into several interfaces that each export one ↵Daniel_Burrows@alumni.brown.edu4-179/+99
piece of its functionality. This will make some of the tests easier to write, since often some of the code requires just the ability to read the screen width, or just the ability to read input from the terminal. Splitting the terminal interface means no need to mock out the parts that aren't used.
2010-07-03Move the search input controller and view classes over to generic/.Daniel_Burrows@alumni.brown.edu3-19/+12
As a side effect, this creates a "controllers" directory in the generic tree, and removes the now-empty GTK+-specific controller and view directories. The README files are moved over to the generic locations and tweaked to be correct for their new home.
2010-07-03Move the throttle object to src/generic/util.Daniel_Burrows@alumni.brown.edu2-13/+13
2010-07-03Move the core command-line progress view interface to generic/views.Daniel_Burrows@alumni.brown.edu3-23/+30
2010-07-03Fix up the SConscript files.Daniel_Burrows@alumni.brown.edu1-0/+2
2010-07-02Remove the now-obsolete preserve_and_advance() routine.Daniel Burrows1-13/+0
Its only real purpose was to do what display_and_advance() does better -- i.e., display a durable progress notification and move to the next line.
2010-07-02Use display_and_advance() for the standard progress meters.Daniel Burrows1-45/+17
2010-07-02Add a routine on transient_message to display a non-wrapped message and move ↵Daniel Burrows1-0/+46
to the next line. This should be useful for things like printing a status message alongside some sort of progress indicator -- set_text() followed by advance() is not really ideal since it truncates the line.
2010-06-30Add a view interface for displaying the download progress and an ↵Daniel_Burrows@alumni.brown.edu3-0/+109
implementation for showing the download progress at the command line and a stub implementation. This is mostly just a streamlining of the apt interface, but putting the code behind a clean view will also make it much more testable.
2010-06-19Don't try to link GTK+-related code into the tests if the GTK+ frontend ↵Daniel Burrows1-2/+5
isn't being built.
2010-06-19Don't try to test the search input controller if the GTK+ frontend wasn't built.Daniel Burrows1-0/+4
If the GTK+ frontend isn't built, neither is the controller, so the test won't build.
2010-06-18Explicitly include gmock/gtest -- they should be picked up by another ↵Daniel Burrows1-0/+3
include file, but I prefer listing all the dependencies anyway.
2010-06-18Extract the declarations of the global pointers to apt structures into a ↵Daniel Burrows1-25/+10
separate file to reduce test dependencies. No reason for tests to pull in half of src/generic/apt just because a module linked into the test happens to reference a global pointer.
2010-06-18Re-enable all the unit tests.Daniel Burrows1-2/+2
It looks like I disabled two of them to speed up testing, then accidentally committed that change.
2010-06-15Add support to the command-line progress display object for showing that the ↵Daniel Burrows3-56/+454
current task is done, and for displaying progress the way classic apt tools do. The new code supports both "[ 40%] Task" and "Task... 40%" display styles, and when a task is complete the code will either erase it (default) or advance to the next terminal line (like apt-get does). These behaviors are controlled by apt options.
2010-06-15Make the testing of search progress throttling hopefully more robust.Daniel Burrows1-15/+16
Instead of relying on knowing how many times each routine checks for throttling, I just fully disable and fully enable throttling depending on whether the next call should be throttled or not.
2010-06-10Put some mock expectations that should be in sequence in the scope of ↵Daniel Burrows1-22/+67
InSequence(). Note that calls to get_screen_width() are left off, since we don't care when it happens and it can happen any number of times.
2010-06-10Add support in the transient message for making a message permanent and ↵Daniel Burrows2-2/+14
advancing to the next line. i.e., for explicitly outputting a newline. The main advantage of this is that it lets me give the progress display a mode that emulates the old apt progress display (specifically, the behavior that completed steps remain visible).
2010-06-10Fix the teletype mock to only output set_last_line() when the last line has ↵Daniel Burrows1-0/+22
actually changed. In particular, this means that outputting "\n" after a flush won't redundantly update the last line.
2010-06-10Don't show any output from the transient message object if the output device ↵Daniel Burrows1-4/+51
isn't a terminal.
2010-06-10Write a test of the command-line search progress object.Daniel Burrows3-1/+221
2010-06-09Write tests of the command-line progress display class.Daniel Burrows3-0/+284
2010-06-07Write tests of the transient-message class.Daniel Burrows3-1/+214
One of the tests fails, and it appears to be a legitimate failure.
2010-06-07Write a test that the teletype mock works when used with a "real" combining ↵Daniel Burrows1-0/+25
terminal mock. Right now it fails because the terminal's move_to_beginning_of_line() behavior is completely hidden by an override in the teletype.
2010-06-07Add a sanity-check to the terminal mock tests that makes the same calls a ↵Daniel Burrows1-0/+22
simple transient message would make.
2010-06-07Write one test to specifically verify that the sequence of characters sent ↵Daniel Burrows1-0/+17
by the transient message has the effect that it should.
2010-06-07Don't depend on the behavior of the combining terminal when testing the ↵Daniel Burrows1-15/+8
teletype mock. I was mixing calls to output() with calls to move_to_beginning_of_line(), which isn't guaranteed to work. Changed to instead encode the \r outputs directly into the strings passed to the mock's output() routine.
2010-06-07Verify that we can output two carriage returns from the fake terminal using ↵Daniel Burrows1-1/+3
move_to_beginning_of_line().
2010-06-07Add a matcher that compares strings by trimming them on the right.Daniel Burrows1-0/+56
With terminal output, we usually know how much space should exist on the left, just not the right.
2010-06-07Wrap a layer of indirection around wcwidth().Daniel Burrows1-13/+11
This is necessary so that I can test the behavior of terminal output routines that care about string widths, without depending on system locale settings or data.
2010-06-06Use wide strings in the terminal wrapper interface.Daniel Burrows2-96/+112
This will make it easier to deal with wide characters properly in the rest of the code. I've also found in the other interfaces that it's just a good idea to use wide strings, to avoid accidentally forgetting a conversion on I/O.
2010-06-06Write tests verifying the behavior of the teletype mock object with respect ↵Daniel Burrows1-1/+162
to wide characters. Note that in order to do this, I *had to modify LC_CTYPE for the duration of the test*. There doesn't seem to be a way around this (short of mocking out the locale system, which would be nuts), and we might have to do the same thing in tests of other parts of the system. Currently these tests fail, because the teletype mock doesn't handle fullwidth characters.
2010-06-05Add a convenience matcher to trim whitespace from strings before matching them.Daniel Burrows1-0/+41
Since output to the terminal often paints spaces to erase characters, this should be useful when testing the terminal-handling code, although it obviously doesn't cover every case.
2010-06-04Write a "teletype" mock/fake object that allows test code to easily examine ↵Daniel Burrows3-0/+168
the effect of a sequence of outputs on a normal terminal.
2010-06-04Retool the terminal mock so that it can be used as a standalone mock.Daniel_Burrows@alumni.brown.edu1-1/+1
The new teletype mock will require a terminal; by using a standalone mock, we can ensure that the tests don't depend on the behavior of the terminal, which should be tested by its own test.
2010-06-04In the mock terminal, make calls to move_to_beginning_of_line() cause '\r' ↵Daniel Burrows1-1/+50
to be placed into the output stream. This is useful because we're normally interested in the relative ordering of \r with respect to the rest of the text; including it as part of the same data stream makes it easy to verify that.
2010-06-03Write a mock of the terminal object that automatically canonicalizes the ↵Daniel Burrows3-2/+209
terminal output. The extra logic is to avoid having tests that depend on exactly how the code being tested breaks up its terminal writes.
2010-06-03Add the gtest test to the automake build.Daniel Burrows1-2/+6
2010-05-28Transition from log4cxx to the new logging framework.Daniel Burrows3-14/+58
Hopefully this will eliminate some of the random crashes on exit that people were seeing.
2010-05-28Add a logging level "off" to disable logging at a given category.Daniel Burrows1-0/+19
log4cxx provided this ability, so I need it for backwards compatibility.
2010-05-28Fix a test of setValue() to use the correct default logging level.Daniel Burrows1-2/+2
All the logging tests pass now.
2010-05-28Fix the test that setLevel() doesn't propagate upwards.Daniel Burrows1-1/+3
2010-05-28Experimentally add support for a suite of tests based on gtest, and convert ↵Daniel Burrows3-69/+115
the logging tests to it. gtest has some nice features for producing extra information in failures that could be handy. Also, it integrates well with gmock; the gmock failures in my Boost tests were sometimes kind of obscure.
2010-05-28Fix a place where the test had mismatched expectations and inputs.Daniel Burrows1-1/+1
2010-05-28Implement operator<< on LoggerPtr, for better dumping of test errors.Daniel Burrows1-0/+9
2010-05-28Write some tests of Logger::getCategory().Daniel Burrows1-0/+23
2010-05-28Sort the "using" declarations in the logging test.Daniel Burrows1-1/+1
2010-05-27Write an initial suite of tests for the new logging code.Daniel Burrows3-0/+436
2010-05-25Refine the existing test of the search input controller so it passes.Daniel Burrows1-1/+15
This modifies the expected behavior to match what I really expect. Specifically: * The controller is allowed to set the error message to "". * After the search text is set to "?installed", the view will return "?installed' from get_search_text(). Regarding that second point: maybe I should make this "save values and return them" the default behavior? Although that starts to open up cans of worms...
2010-05-25Add some glue code to make mock errors generate Boost.Test failures instead ↵Daniel Burrows1-7/+26
of killing the test forcefully.