diff --git a/src/tests/servers/app/Jamfile b/src/tests/servers/app/Jamfile index cb7ae73adf..45426dd264 100644 --- a/src/tests/servers/app/Jamfile +++ b/src/tests/servers/app/Jamfile @@ -81,6 +81,7 @@ local decorator_src = DefaultDecorator.cpp DefaultWindowBehaviour.cpp MagneticBorder.cpp + TabDecorator.cpp WindowBehaviour.cpp ; @@ -233,6 +234,7 @@ SubInclude HAIKU_TOP src tests servers app drawing_modes ; SubInclude HAIKU_TOP src tests servers app event_mask ; SubInclude HAIKU_TOP src tests servers app find_view ; SubInclude HAIKU_TOP src tests servers app following ; +SubInclude HAIKU_TOP src tests servers app font_spacing ; SubInclude HAIKU_TOP src tests servers app hide_and_show ; SubInclude HAIKU_TOP src tests servers app idle_test ; SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ; diff --git a/src/tests/servers/app/font_spacing/Jamfile b/src/tests/servers/app/font_spacing/Jamfile new file mode 100644 index 0000000000..b54648a19c --- /dev/null +++ b/src/tests/servers/app/font_spacing/Jamfile @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src tests servers app font_spacing ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +SimpleTest FontSpacing : + main.cpp + : be $(TARGET_LIBSUPC++) + : + ; + +if ( $(TARGET_PLATFORM) = libbe_test ) { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : FontSpacing + : tests!apps ; +} diff --git a/src/tests/servers/app/font_spacing/main.cpp b/src/tests/servers/app/font_spacing/main.cpp new file mode 100644 index 0000000000..cab6195592 --- /dev/null +++ b/src/tests/servers/app/font_spacing/main.cpp @@ -0,0 +1,100 @@ +/* + * Copyright 2014 Stephan Aßmus + * All rights reserved. Distributed under the terms of the MIT license. + */ + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +static const char* kAppSignature = "application/x.vnd-Haiku.FontSpacing"; + + +class TestView : public BView { +public: + TestView(); + virtual ~TestView(); + + virtual void Draw(BRect updateRect); +}; + + +TestView::TestView() + : + BView(NULL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) +{ +} + + +TestView::~TestView() +{ +} + + +void +TestView::Draw(BRect updateRect) +{ + float scale = Bounds().Width() / 400.0f; + + if (scale < 0.25f) + scale = 0.25f; + else if (scale > 3.0f) + scale = 3.0f; + + SetScale(scale); + + const char* string = "Testing the various BFont spacing modes."; + + BFont font; + SetFont(&font); + DrawString(string, BPoint(30.0f, 25.0f)); + + font.SetSpacing(B_STRING_SPACING); + SetFont(&font); + DrawString(string, BPoint(30.0f, 45.0f)); + + font.SetSpacing(B_CHAR_SPACING); + SetFont(&font); + DrawString(string, BPoint(30.0f, 65.0f)); +} + + +// #pragma mark - + + +int +main(int argc, char** argv) +{ + BApplication app(kAppSignature); + + BWindow* window = new BWindow(BRect(50, 50, 450, 450), "Font spacing test", + B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_QUIT_ON_WINDOW_CLOSE + | B_AUTO_UPDATE_SIZE_LIMITS); + + BLayoutBuilder::Group<>(window) + .Add(new TestView()) + ; + + window->Show(); + + app.Run(); + return 0; +}