Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
transformpresentation_test.cc File Reference
#include <gmock/gmock-more-actions.h>
#include <gtest/gtest.h>
#include <scroom/bitmap-helpers.hh>
#include <scroom/dont-delete.hh>
#include <scroom/gmock/presentationinterface.hh>
#include <scroom/rectangle.hh>
#include <scroom/transformpresentation.hh>
Include dependency graph for transformpresentation_test.cc:

Functions

bool points_are_close (Scroom::Utils::Point< double > const &a, Scroom::Utils::Point< double > const &b)
 
bool rects_are_close (Scroom::Utils::Rectangle< double > const &a, Scroom::Utils::Rectangle< double > const &b)
 
bool operator== (ViewInterface::WeakPtr const &a, ViewInterface::WeakPtr const &b)
 
td setAspectRatio (2, 3)
 
 EXPECT_PRED2 (points_are_close, Scroom::Utils::Point< double >(2, 3), td->getAspectRatio())
 
ViewInterface::Ptr const vi (reinterpret_cast< ViewInterface * >(1), DontDelete< ViewInterface >())
 
EXPECT_CALL * cpm (_)).InSequence(seq).WillOnce(SaveArg< 0 >(&viw)
 
EXPECT_CALL * cpm (Eq(ByRef(viw)), _, _, _)).WillOnce(DoAll(SaveArg< 2 >(&requested_to_be_drawn), SaveArg< 3 >(&used_zoom))
 
EXPECT_CALL * cpm (Eq(ByRef(viw)))
 
 EXPECT_PRED2 (rects_are_close, make_rect(2.0, 6.0, 6.0, 12.0), r)
 
tp open (vi)
 
tp redraw (vi, cr, to_be_drawn, zoom_to_use)
 
 EXPECT_PRED2 (rects_are_close, make_rect(0.5, 1.5, 2.0, 3.0), requested_to_be_drawn)
 
 EXPECT_EQ (zoom_to_use, used_zoom)
 
 cairo_destroy (cr)
 
tp close (vi)
 

Variables

ColormappablePresentationMock::Ptr const cpm = ColormappablePresentationMock::create()
 
TransformPresentation::Ptr const tp = TransformPresentation::create(cpm, td)
 
ViewInterface::WeakPtr viw
 
Sequence const seq
 
const Scroom::Utils::Rectangle< double > to_be_drawn = make_rect(1.0, 4.5, 4.0, 9.0)
 
const int zoom_to_use = 3
 
Scroom::Utils::Rectangle< double > requested_to_be_drawn
 
int used_zoom
 
Scroom::Utils::Rectangle< double > const r = tp->getRect()
 
BitmapSurface::Ptr const s = BitmapSurface::create(10, 10, CAIRO_FORMAT_ARGB32)
 
cairo_surface_t * surface = s->get()
 
cairo_t * cr = cairo_create(surface)
 

Function Documentation

◆ cairo_destroy()

cairo_destroy ( cr  )

◆ close()

tp close ( vi  )

◆ cpm() [1/3]

EXPECT_CALL * cpm ( ) &

◆ cpm() [2/3]

EXPECT_CALL * cpm ( Eq(ByRef(viw))  )

◆ cpm() [3/3]

EXPECT_CALL * cpm ( Eq(ByRef(viw))  ,
,
,
 
) &

◆ EXPECT_EQ()

EXPECT_EQ ( zoom_to_use  ,
used_zoom   
)

◆ EXPECT_PRED2() [1/3]

EXPECT_PRED2 ( points_are_close  ,
Scroom::Utils::Point< double >  2, 3,
td->  getAspectRatio() 
)

◆ EXPECT_PRED2() [2/3]

EXPECT_PRED2 ( rects_are_close  ,
make_rect(0.5, 1.5, 2.0, 3.0)  ,
requested_to_be_drawn   
)

◆ EXPECT_PRED2() [3/3]

EXPECT_PRED2 ( rects_are_close  ,
make_rect(2.0, 6.0, 6.0, 12.0)  ,
r   
)

◆ open()

tp open ( vi  )

◆ operator==()

bool operator== ( ViewInterface::WeakPtr const &  a,
ViewInterface::WeakPtr const &  b 
)
39{ return a.lock() == b.lock(); }
std::shared_ptr< A > a
Definition async-deleter-tests.cc:60
Blob::Ptr const b
Definition blob-tests.cc:118

◆ points_are_close()

bool points_are_close ( Scroom::Utils::Point< double > const &  a,
Scroom::Utils::Point< double > const &  b 
)
30{
31 return (a - b).magnitude() < 1e-6;
32}

Referenced by rects_are_close().

Here is the caller graph for this function:

◆ rects_are_close()

bool rects_are_close ( Scroom::Utils::Rectangle< double > const &  a,
Scroom::Utils::Rectangle< double > const &  b 
)
35{
36 return points_are_close(a.getTopLeft(), b.getTopLeft()) && points_are_close(a.getBottomRight(), b.getBottomRight());
37}
bool points_are_close(Scroom::Utils::Point< double > const &a, Scroom::Utils::Point< double > const &b)
Definition transformpresentation_test.cc:29
Here is the call graph for this function:

◆ redraw()

tp redraw ( vi  ,
cr  ,
to_be_drawn  ,
zoom_to_use   
)

◆ setAspectRatio()

td setAspectRatio ( ,
 
)

◆ vi()

ViewInterface::Ptr const vi ( reinterpret_cast< ViewInterface * >  1,
DontDelete< ViewInterface () 
)

Variable Documentation

◆ cpm

◆ cr

◆ r

◆ requested_to_be_drawn

Scroom::Utils::Rectangle<double> requested_to_be_drawn

◆ s

test_count_equals & s = BitmapSurface::create(10, 10, CAIRO_FORMAT_ARGB32)

◆ seq

Sequence const seq

◆ surface

◆ to_be_drawn

const Scroom::Utils::Rectangle<double> to_be_drawn = make_rect(1.0, 4.5, 4.0, 9.0)

◆ tp

◆ used_zoom

int used_zoom

◆ viw

◆ zoom_to_use

const int zoom_to_use = 3