Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0d4233ef
Kaydet (Commit)
0d4233ef
authored
Ara 01, 2014
tarafından
Michael Meeks
Kaydeden (comit)
Jan Holesovsky
Ara 02, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: improve vcldemo & outdev test.
Change-Id: I1ebc3c3b3cffabc8ba446ecd45ac2d9b0d45aff1
üst
2b433d87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
9 deletions
+84
-9
outdev.cxx
vcl/qa/cppunit/outdev.cxx
+21
-6
vcldemo.cxx
vcl/workben/vcldemo.cxx
+63
-3
No files found.
vcl/qa/cppunit/outdev.cxx
Dosyayı görüntüle @
0d4233ef
...
...
@@ -15,6 +15,9 @@
#include <vcl/bmpacc.hxx>
#include <vcl/wrkwin.hxx>
#include <tools/stream.hxx>
#include <vcl/pngwrite.hxx>
class
VclOutdevTest
:
public
test
::
BootstrapFixture
{
public
:
...
...
@@ -36,18 +39,30 @@ void VclOutdevTest::testVirtualDevice()
aVDev
.
DrawPixel
(
Point
(
1
,
2
),
COL_GREEN
);
aVDev
.
DrawPixel
(
Point
(
31
,
30
),
COL_RED
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
0
,
0
))
==
COL_WHITE
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
1
,
2
))
==
COL_GREEN
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
31
,
30
))
==
COL_RED
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
30
,
31
))
==
COL_WHITE
);
Size
aSize
=
aVDev
.
GetOutputSizePixel
();
CPPUNIT_ASSERT
(
aSize
==
Size
(
32
,
32
));
Bitmap
aBmp
=
aVDev
.
GetBitmap
(
Point
(),
aSize
);
Bitmap
::
ScopedReadAccess
pAcc
(
aBmp
);
#if 0
OUString rFileName("/tmp/foo-unx.png");
try {
vcl::PNGWriter aWriter( aBmp );
SvFileStream sOutput( rFileName, STREAM_WRITE );
aWriter.Write( sOutput );
sOutput.Close();
} catch (...) {
SAL_WARN("vcl", "Error writing png to " << rFileName);
}
#endif
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
0
,
0
))
==
COL_WHITE
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
1
,
2
))
==
COL_GREEN
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
31
,
30
))
==
COL_RED
);
CPPUNIT_ASSERT
(
aVDev
.
GetPixel
(
Point
(
30
,
31
))
==
COL_WHITE
);
// Gotcha: y and x swap for BitmapReadAccess: deep joy.
Bitmap
::
ScopedReadAccess
pAcc
(
aBmp
);
CPPUNIT_ASSERT
(
pAcc
->
GetPixel
(
0
,
0
)
==
Color
(
COL_WHITE
));
CPPUNIT_ASSERT
(
pAcc
->
GetPixel
(
2
,
1
)
==
Color
(
COL_GREEN
));
CPPUNIT_ASSERT
(
pAcc
->
GetPixel
(
30
,
31
)
==
Color
(
COL_RED
));
...
...
vcl/workben/vcldemo.cxx
Dosyayı görüntüle @
0d4233ef
...
...
@@ -15,6 +15,7 @@
#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <vcl/vclmain.hxx>
#include <vcl/layout.hxx>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
...
...
@@ -1251,6 +1252,55 @@ public:
}
};
class
DemoWidgets
:
public
WorkWindow
{
VclBox
*
mpBox
;
public
:
DemoWidgets
()
:
WorkWindow
(
NULL
,
WB_STDWORK
)
{
SetText
(
"VCL widget demo"
);
mpBox
=
new
VclVBox
(
this
,
false
,
3
);
Wallpaper
aWallpaper
(
BitmapEx
(
"sfx2/res/startcenter-logo.png"
));
aWallpaper
.
SetStyle
(
WALLPAPER_BOTTOMRIGHT
);
aWallpaper
.
SetColor
(
COL_RED
);
mpBox
->
SetBackground
(
aWallpaper
);
mpBox
->
Show
();
Show
();
}
virtual
~
DemoWidgets
()
{
}
virtual
void
Paint
(
const
Rectangle
&
)
{
Rectangle
aWholeSize
(
Point
(
0
,
0
),
GetOutputSizePixel
());
vcl
::
Region
aClip
(
aWholeSize
);
Rectangle
aExclude
(
Rectangle
(
Point
(
50
,
50
),
Size
(
100
,
100
)));
aClip
.
Exclude
(
aExclude
);
Wallpaper
aWallpaper
(
COL_GREEN
);
Push
(
PushFlags
::
CLIPREGION
);
IntersectClipRegion
(
aClip
);
DrawWallpaper
(
aWholeSize
,
aWallpaper
);
Pop
();
VirtualDevice
aDev
(
*
this
);
aDev
.
EnableRTL
(
IsRTLEnabled
());
aDev
.
SetOutputSizePixel
(
aExclude
.
GetSize
());
Rectangle
aSubRect
(
aWholeSize
);
aSubRect
.
Move
(
-
aExclude
.
Left
(),
-
aExclude
.
Top
());
aDev
.
DrawWallpaper
(
aSubRect
,
aWallpaper
);
DrawOutDev
(
aExclude
.
TopLeft
(),
aExclude
.
GetSize
(),
Point
(
0
,
0
),
aExclude
.
GetSize
(),
aDev
);
}
};
class
DemoApp
:
public
Application
{
...
...
@@ -1262,7 +1312,9 @@ class DemoApp : public Application
OUString
aRenderers
(
rRenderer
.
getRendererList
());
fprintf
(
stderr
,
" %s
\n
"
,
rtl
::
OUStringToOString
(
aRenderers
,
RTL_TEXTENCODING_UTF8
).
getStr
());
fprintf
(
stderr
,
" --test <iterCount> - create benchmark data
\n\n
"
);
fprintf
(
stderr
,
" --test <iterCount> - create benchmark data
\n
"
);
fprintf
(
stderr
,
" --widgets - launch the widget test.
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
return
0
;
}
...
...
@@ -1273,6 +1325,7 @@ public:
{
try
{
bool
bWidgets
=
false
;
DemoRenderer
aRenderer
;
for
(
sal_Int32
i
=
0
;
i
<
GetCommandLineParamCount
();
i
++
)
...
...
@@ -1288,19 +1341,26 @@ public:
else
aRenderer
.
selectRenderer
(
GetCommandLineParam
(
++
i
));
}
if
(
aArg
==
"--test"
)
else
if
(
aArg
==
"--test"
)
{
if
(
bLast
)
return
showHelp
(
aRenderer
);
else
aRenderer
.
setIterCount
(
GetCommandLineParam
(
++
i
).
toInt32
());
}
else
if
(
aArg
==
"--widgets"
)
bWidgets
=
true
;
}
DemoWin
aMainWin
(
aRenderer
);
boost
::
scoped_ptr
<
DemoWidgets
>
aWidgets
;
aMainWin
.
SetText
(
"Interactive VCL demo #1"
);
aMainWin
.
Show
();
if
(
bWidgets
)
aWidgets
.
reset
(
new
DemoWidgets
());
else
aMainWin
.
Show
();
Application
::
Execute
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment