[Libreoffice-commits] core.git: Branch 'feature/lok_sofficemain' - 9 commits - desktop/source libreofficekit/qa
Andrzej Hunt
andrzej.hunt at collabora.com
Tue Aug 5 10:20:31 PDT 2014
desktop/source/lib/init.cxx | 101 +++++++++-----------
libreofficekit/qa/data/blank_presentation.odp |binary
libreofficekit/qa/data/blank_text.odt |binary
libreofficekit/qa/data/impress_slidenames.odp |binary
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 29 ++++-
libreofficekit/qa/unit/tiledrendering.cxx | 100 +++++++++++++++++--
6 files changed, 160 insertions(+), 70 deletions(-)
New commits:
commit 8fd04dd87339c86636ca2285e5aac2b643276115
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 11:57:09 2014 +0200
LOK: add document loading failure test.
We don't really have any way of telling the client that the file didn't
exist yet though, so not very useful so far.
Change-Id: I1db386781b88b345f3e9cb4f37838ca1d95f92f9
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 043ffaf..5d61000 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -48,6 +48,7 @@ public:
// components on the one Office instance that we retrieve.
void runAllTests();
+ void testDocumentLoadFail( Office* pOffice );
void testDocumentTypes( Office* pOffice );
void testImpressSlideNames( Office* pOffice );
void testOverlay( Office* pOffice );
@@ -63,11 +64,23 @@ void TiledRenderingTest::runAllTests()
m_sLOPath.c_str() ) );
CPPUNIT_ASSERT( pOffice.get() );
+ testDocumentLoadFail( pOffice.get() );
testDocumentTypes( pOffice.get() );
testImpressSlideNames( pOffice.get() );
testOverlay( pOffice.get() );
}
+void TiledRenderingTest::testDocumentLoadFail( Office* pOffice )
+{
+ const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/IDONOTEXIST.odt";
+ scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) );
+ CPPUNIT_ASSERT( !pDocument.get() );
+ // TODO: we probably want to have some way of returning what
+ // the cause of failure was. getError() will return
+ // something along the lines of:
+ // "Unsupported URL <file:///SRC_ROOT/libreofficekit/qa/data/IDONOTEXIST.odt>: "type detection failed""
+}
+
// Our dumped .png files end up in
// workdir/CppunitTest/libreofficekit_tiledrendering.test.core
commit 8c1bb1cd0e6e08b5aedb67c1279dcd5f57050238
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 11:20:00 2014 +0200
LOK documentLoad needs SolarMutex protection too.
We probably need to do this for most of LOK now that
we use soffice_main.
Change-Id: I77be7865511c083679cf2f68b0e5df106506fd70
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a521d06..a08ab93 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -282,6 +282,8 @@ static LibreOfficeKitDocument* lo_documentLoad(LibreOfficeKit* pThis, const char
OUString aURL = getAbsoluteURL(pURL);
+ SolarMutexGuard aGuard;
+
uno::Reference<frame::XDesktop2> xComponentLoader = frame::Desktop::create(xContext);
pLib->maLastExceptionMsg = "";
commit 9be8958a9470be52221906999f28bf8541733341
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 10:22:55 2014 +0200
LOK: add test for getDocumentType.
Change-Id: I264567f73dae9ecd061e09c4413857f793fcac48
diff --git a/libreofficekit/qa/data/blank_presentation.odp b/libreofficekit/qa/data/blank_presentation.odp
new file mode 100644
index 0000000..fd68d9a
Binary files /dev/null and b/libreofficekit/qa/data/blank_presentation.odp differ
diff --git a/libreofficekit/qa/data/blank_text.odt b/libreofficekit/qa/data/blank_text.odt
new file mode 100644
index 0000000..00b92d7
Binary files /dev/null and b/libreofficekit/qa/data/blank_text.odt differ
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index c544615..043ffaf 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -48,6 +48,7 @@ public:
// components on the one Office instance that we retrieve.
void runAllTests();
+ void testDocumentTypes( Office* pOffice );
void testImpressSlideNames( Office* pOffice );
void testOverlay( Office* pOffice );
@@ -62,6 +63,7 @@ void TiledRenderingTest::runAllTests()
m_sLOPath.c_str() ) );
CPPUNIT_ASSERT( pOffice.get() );
+ testDocumentTypes( pOffice.get() );
testImpressSlideNames( pOffice.get() );
testOverlay( pOffice.get() );
}
@@ -83,6 +85,34 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
sOutput.Close();
}
+LibreOfficeKitDocumentType getDocumentType( Office* pOffice, const string& rPath )
+{
+ scoped_ptr< Document> pDocument( pOffice->documentLoad( rPath.c_str() ) );
+ CPPUNIT_ASSERT( pDocument.get() );
+ return pDocument->getDocumentType();
+}
+
+void TiledRenderingTest::testDocumentTypes( Office* pOffice )
+{
+ const string sTextDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_text.odt";
+ const string sTextLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_text.odt#";
+
+ // FIXME: same comment as below wrt lockfile removal.
+ remove( sTextLockFile.c_str() );
+
+ CPPUNIT_ASSERT( getDocumentType( pOffice, sTextDocPath ) == LOK_DOCTYPE_TEXT );
+
+ const string sPresentationDocPath = m_sSrcRoot + "/libreofficekit/qa/data/blank_presentation.odp";
+ const string sPresentationLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.blank_presentation.odp#";
+
+ // FIXME: same comment as below wrt lockfile removal.
+ remove( sPresentationLockFile.c_str() );
+
+ CPPUNIT_ASSERT( getDocumentType( pOffice, sPresentationDocPath ) == LOK_DOCTYPE_PRESENTATION );
+
+ // TODO: do this for all supported document types
+}
+
void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
{
const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/impress_slidenames.odp";
commit a39a0a253d99308754a348747bb8d6c5b383c30d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 10:08:57 2014 +0200
LOK: add slide name retrieval test.
Change-Id: I6d2bc4dfa634223da662af6f7c9a91f06cfe7534
diff --git a/libreofficekit/qa/data/impress_slidenames.odp b/libreofficekit/qa/data/impress_slidenames.odp
new file mode 100644
index 0000000..d7cb6ae
Binary files /dev/null and b/libreofficekit/qa/data/impress_slidenames.odp differ
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 74e0634..c544615 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -48,6 +48,7 @@ public:
// components on the one Office instance that we retrieve.
void runAllTests();
+ void testImpressSlideNames( Office* pOffice );
void testOverlay( Office* pOffice );
CPPUNIT_TEST_SUITE(TiledRenderingTest);
@@ -61,6 +62,7 @@ void TiledRenderingTest::runAllTests()
m_sLOPath.c_str() ) );
CPPUNIT_ASSERT( pOffice.get() );
+ testImpressSlideNames( pOffice.get() );
testOverlay( pOffice.get() );
}
@@ -81,6 +83,27 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
sOutput.Close();
}
+void TiledRenderingTest::testImpressSlideNames( Office* pOffice )
+{
+ const string sDocPath = m_sSrcRoot + "/libreofficekit/qa/data/impress_slidenames.odp";
+ const string sLockFile = m_sSrcRoot +"/libreofficekit/qa/data/.~lock.impress_slidenames.odp#";
+
+ // FIXME: this is a temporary hack: LOK will fail when trying to open a
+ // locked file, and since we're reusing the file for a different unit
+ // test it's entirely possible that an unwanted lock file will remain.
+ // Hence forcefully remove it here.
+ remove( sLockFile.c_str() );
+
+ scoped_ptr< Document> pDocument( pOffice->documentLoad( sDocPath.c_str() ) );
+
+ CPPUNIT_ASSERT( pDocument->getParts() == 3 );
+ CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 0 ), "TestText1" ) == 0 );
+ CPPUNIT_ASSERT( strcmp( pDocument->getPartName( 1 ), "TestText2" ) == 0 );
+ // The third slide hasn't had a name given to it (i.e. using the rename
+ // context menu in Impress), thus it should (as far as I can determine)
+ // have a localised version of "Slide 3".
+}
+
void TiledRenderingTest::testOverlay( Office* pOffice )
{
const string sDocPath = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
commit 8da8e4ce8519cb7e842ea08a5d0e9d23480a9d7a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 10:07:39 2014 +0200
Use one test instance to run all LOK tests.
Recreating Office instances after destruction (when still
within the same process) currently fails, hence we need
to do all tests at once for now.
Change-Id: Ic7652c909e1cd970fe1ee76995e61fb6aae8f96c
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 8ff343b..74e0634 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -42,13 +42,28 @@ public:
TiledRenderingTest() {}
- void testOverlay();
+ // Currently it isn't possible to do multiple startup/shutdown
+ // cycle of LOK in a single process -- hence we run all our tests
+ // as one test, which simply carries out the individual test
+ // components on the one Office instance that we retrieve.
+ void runAllTests();
+
+ void testOverlay( Office* pOffice );
CPPUNIT_TEST_SUITE(TiledRenderingTest);
- CPPUNIT_TEST(testOverlay);
+ CPPUNIT_TEST(runAllTests);
CPPUNIT_TEST_SUITE_END();
};
+void TiledRenderingTest::runAllTests()
+{
+ scoped_ptr< Office > pOffice( lok_cpp_init(
+ m_sLOPath.c_str() ) );
+ CPPUNIT_ASSERT( pOffice.get() );
+
+ testOverlay( pOffice.get() );
+}
+
// Our dumped .png files end up in
// workdir/CppunitTest/libreofficekit_tiledrendering.test.core
@@ -66,7 +81,7 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
sOutput.Close();
}
-void TiledRenderingTest::testOverlay()
+void TiledRenderingTest::testOverlay( Office* pOffice )
{
const string sDocPath = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
const string sLockFile = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/.~lock.test1.odt#";
@@ -77,10 +92,6 @@ void TiledRenderingTest::testOverlay()
// Hence forcefully remove it here.
remove( sLockFile.c_str() );
- scoped_ptr< Office > pOffice( lok_cpp_init(
- m_sLOPath.c_str() ) );
- assert( pOffice.get() );
-
scoped_ptr< Document> pDocument( pOffice->documentLoad(
sDocPath.c_str() ) );
commit d3bfbf945a6d8a07a1e993012ee49c729299108d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Jul 30 19:52:46 2014 +0200
Make common paths member variables.
We'll need these for other tests too.
Change-Id: Ia99c2e60f5e5bb24a83875a9dcf85a6b4f54beb4
diff --git a/libreofficekit/qa/unit/tiledrendering.cxx b/libreofficekit/qa/unit/tiledrendering.cxx
index 73958e2..8ff343b 100644
--- a/libreofficekit/qa/unit/tiledrendering.cxx
+++ b/libreofficekit/qa/unit/tiledrendering.cxx
@@ -36,6 +36,10 @@ using namespace ::std;
class TiledRenderingTest : public ::CppUnit::TestFixture
{
public:
+ const string m_sSrcRoot = getenv( "SRC_ROOT" );
+ const string m_sInstDir = getenv( "INSTDIR" );
+ const string m_sLOPath = m_sInstDir + "/program";
+
TiledRenderingTest() {}
void testOverlay();
@@ -64,11 +68,8 @@ static void dumpRGBABitmap( const OUString& rPath, const unsigned char* pBuffer,
void TiledRenderingTest::testOverlay()
{
- const string sSrcRoot = getenv( "SRC_ROOT" );
- const string sInstDir = getenv( "INSTDIR" );
- const string sLOPath = sInstDir + "/program";
- const string sDocPath = sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
- const string sLockFile = sSrcRoot + "/odk/examples/java/DocumentHandling/test/.~lock.test1.odt#";
+ const string sDocPath = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/test1.odt";
+ const string sLockFile = m_sSrcRoot + "/odk/examples/java/DocumentHandling/test/.~lock.test1.odt#";
// FIXME: this is a temporary hack: LOK will fail when trying to open a
// locked file, and since we're reusing the file for a different unit
@@ -77,7 +78,7 @@ void TiledRenderingTest::testOverlay()
remove( sLockFile.c_str() );
scoped_ptr< Office > pOffice( lok_cpp_init(
- sLOPath.c_str() ) );
+ m_sLOPath.c_str() ) );
assert( pOffice.get() );
scoped_ptr< Document> pDocument( pOffice->documentLoad(
commit 7aeb75057e33a55162ec256bf8f314a8bc3aa191
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Jul 30 15:16:49 2014 +0200
Use SolarMutexGuard instead of pairs of Acquire/ReleaseSolarMutex
Change-Id: I7ff41dd932fd9860dff944b3bf8ff5bdc230ae5d
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f12e841..a521d06 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -472,11 +472,8 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
return;
}
- Application::AcquireSolarMutex(1);
- {
- pDoc->setPart( nPart );
- }
- Application::ReleaseSolarMutex();
+ SolarMutexGuard aGuard;
+ pDoc->setPart( nPart );
}
static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
@@ -510,31 +507,29 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
return;
}
- Application::AcquireSolarMutex(1);
+ SolarMutexGuard aGuard;
+
+ int nCurrentPart = pDoc->getPart();
+
+ pDoc->setPartMode(ePartMode);
+
+ // We need to make sure the internal state is updated, just changing the mode
+ // might not update the relevant shells (i.e. impress will keep rendering the
+ // previous mode unless we do this).
+ // TODO: we might want to do this within the relevant components rather than
+ // here, but that's also dependent on how we implement embedded object
+ // rendering I guess?
+ // TODO: we could be clever and e.g. set to 0 when we change to/from
+ // embedded object mode, and not when changing between slide/notes/combined
+ // modes?
+ if ( nCurrentPart < pDoc->getParts() )
{
- int nCurrentPart = pDoc->getPart();
-
- pDoc->setPartMode(ePartMode);
-
- // We need to make sure the internal state is updated, just changing the mode
- // might not update the relevant shells (i.e. impress will keep rendering the
- // previous mode unless we do this).
- // TODO: we might want to do this within the relevant components rather than
- // here, but that's also dependent on how we implement embedded object
- // rendering I guess?
- // TODO: we could be clever and e.g. set to 0 when we change to/from
- // embedded object mode, and not when changing between slide/notes/combined
- // modes?
- if ( nCurrentPart < pDoc->getParts() )
- {
- pDoc->setPart( nCurrentPart );
- }
- else
- {
- pDoc->setPart( 0 );
- }
+ pDoc->setPart( nCurrentPart );
+ }
+ else
+ {
+ pDoc->setPart( 0 );
}
- Application::ReleaseSolarMutex();
}
void doc_paintTile (LibreOfficeKitDocument* pThis,
@@ -556,38 +551,36 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
return;
}
- Application::AcquireSolarMutex(1);
- {
+ SolarMutexGuard aGuard;
+
#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
- ImplSVData* pSVData = ImplGetSVData();
- SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
- pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA );
+ ImplSVData* pSVData = ImplGetSVData();
+ SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst);
+ pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA );
- VirtualDevice aDevice(0, (sal_uInt16)32);
- boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
- aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
- Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
- aBuffer, true );
+ VirtualDevice aDevice(0, (sal_uInt16)32);
+ boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
+ aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
+ Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
+ aBuffer, true );
- pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
- nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+ pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY, nTileWidth, nTileHeight);
- SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice());
- basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice();
+ SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice());
+ basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice();
- *pRowStride = pBmpDev->getScanlineStride();
+ *pRowStride = pBmpDev->getScanlineStride();
#else
- (void) pBuffer;
- (void) nCanvasWidth;
- (void) nCanvasHeight;
- (void) pRowStride;
- (void) nTilePosX;
- (void) nTilePosY;
- (void) nTileWidth;
- (void) nTileHeight;
+ (void) pBuffer;
+ (void) nCanvasWidth;
+ (void) nCanvasHeight;
+ (void) pRowStride;
+ (void) nTilePosX;
+ (void) nTilePosY;
+ (void) nTileWidth;
+ (void) nTileHeight;
#endif
- }
- Application::ReleaseSolarMutex();
}
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
commit 20869562e5c62f0726650cb8922cf3bb38cb15ac
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Jul 30 07:33:54 2014 +0200
LokDocView: Update part selector when mode changes.
Change-Id: Ice754a46d07ce2714257c30e1aef27193b614cd3
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c588993..9a40325 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -27,6 +27,7 @@ static int help()
static GtkWidget* pDocView;
static GtkWidget* pDocViewQuad;
static GtkWidget* pVBox;
+static GtkComboBoxText* pPartSelector;
static LibreOfficeKit* pOffice;
static char* pFileName;
@@ -121,20 +122,29 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
// GtkComboBox requires gtk 2.24 or later
#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
-void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
+void populatePartSelector()
{
+ gtk_list_store_clear( GTK_LIST_STORE(
+ gtk_combo_box_get_model(
+ GTK_COMBO_BOX(pPartSelector) )) );
+
+ if ( !pDocView )
+ {
+ return;
+ }
+
const int nMaxLength = 50;
char sText[nMaxLength];
- int nParts = lok_docview_get_parts(pView);
+ int nParts = lok_docview_get_parts( LOK_DOCVIEW(pDocView) );
for ( int i = 0; i < nParts; i++ )
{
- char* pName = lok_docview_get_part_name( pView, i );
+ char* pName = lok_docview_get_part_name( LOK_DOCVIEW(pDocView), i );
assert( pName );
snprintf( sText, nMaxLength, "%i (%s)", i+1, pName );
free( pName );
- gtk_combo_box_text_append_text( pSelector, sText );
+ gtk_combo_box_text_append_text( pPartSelector, sText );
}
gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector),
lok_docview_get_part( LOK_DOCVIEW(pDocView) ) );
@@ -174,6 +184,10 @@ void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
{
lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode );
}
+
+ // The number of items could change e.g. if we change from slide
+ // to embeddede obj mode -- hence we should update the part list.
+ populatePartSelector();
}
#endif
@@ -232,6 +246,8 @@ int main( int argc, char* argv[] )
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 );
g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL );
+ pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox);
+
GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
@@ -265,7 +281,7 @@ int main( int argc, char* argv[] )
// GtkComboBox requires gtk 2.24 or later
#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
- populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
+ populatePartSelector();
populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
#endif
commit 00faf43af4fb162beed5edc463f2f6718502ca20
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Jul 30 07:33:35 2014 +0200
LokDocView: set current item for part selector.
Change-Id: Idbb3d63803bd60a182a9b8e26620d11b2d643cb6
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index a96e1e3..c588993 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -136,7 +136,8 @@ void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
gtk_combo_box_text_append_text( pSelector, sText );
}
- gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector),
+ lok_docview_get_part( LOK_DOCVIEW(pDocView) ) );
}
void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
More information about the Libreoffice-commits
mailing list