Skip to content
Snippets Groups Projects
Commit a6b3a818 authored by Bill Lorensen's avatar Bill Lorensen Committed by Code Review
Browse files

Merge topic 'Coverage_CornerAnnotation' into master

4943d65b Tests: Add test for the vtkCornerAnnotation class
parents 90acce9f 4943d65b
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ vtk_add_test_cxx(
TestAxisActor3D.cxx
TestBarChartActor.cxx
TestCaptionActor2D.cxx
TestCornerAnnotation.cxx
TestCubeAxes2DMode.cxx
TestCubeAxes3.cxx
TestCubeAxesWithGridLines.cxx
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestCornerAnnotation.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include <vtkSmartPointer.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTextProperty.h>
#include <vtkSphereSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkCornerAnnotation.h>
#include <vtkRegressionTestImage.h>
int TestCornerAnnotation( int argc, char * argv [] )
{
vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
sphereSource->Update();
vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(sphereSource->GetOutputPort());
vtkSmartPointer<vtkActor> actor =
vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
// Visualize
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(actor);
// Annotate the image with window/level and mouse over pixel information
vtkSmartPointer<vtkCornerAnnotation> cornerAnnotation =
vtkSmartPointer<vtkCornerAnnotation>::New();
cornerAnnotation->SetLinearFontScaleFactor( 2 );
cornerAnnotation->SetNonlinearFontScaleFactor( 1 );
cornerAnnotation->SetMaximumFontSize( 20 );
cornerAnnotation->SetText( 0, "lower left" );
cornerAnnotation->SetText( 1, "lower right" );
cornerAnnotation->SetText( 2, "upper left" );
cornerAnnotation->SetText( 3, "upper right" );
cornerAnnotation->GetTextProperty()->SetColor( 1,0,0);
renderer->AddViewProp(cornerAnnotation);
renderWindow->Render();
int retVal = vtkRegressionTestImage(renderWindow);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
renderWindowInteractor->Start();
}
return !retVal;
}
217d4fbb2dec6374dcf20b9f290393d7
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment