Use the bundled PDF tools
This commit is contained in:
parent
e3dee4dee7
commit
0d5ea8520a
15 changed files with 42 additions and 954 deletions
|
@ -1,12 +1,10 @@
|
|||
describe("Zotero.Fulltext", function () {
|
||||
var win, pdfToolsVersion;
|
||||
var win;
|
||||
|
||||
before(function* () {
|
||||
// Hidden browser, which requires a browser window, needed for charset detection
|
||||
// (until we figure out a better way)
|
||||
win = yield loadBrowserWindow();
|
||||
|
||||
pdfToolsVersion = Zotero.isWin ? '3.02a' : '3.04';
|
||||
});
|
||||
after(function () {
|
||||
if (win) {
|
||||
|
@ -15,11 +13,6 @@ describe("Zotero.Fulltext", function () {
|
|||
});
|
||||
|
||||
describe("Indexing", function () {
|
||||
before(function* () {
|
||||
yield Zotero.Fulltext.downloadPDFTool('info', pdfToolsVersion);
|
||||
yield Zotero.Fulltext.downloadPDFTool('converter', pdfToolsVersion);
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
Zotero.Prefs.clear('fulltext.textMaxLength');
|
||||
Zotero.Prefs.clear('fulltext.pdfMaxPages');
|
||||
|
@ -92,80 +85,7 @@ describe("Zotero.Fulltext", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("#downloadPDFTool()", function () {
|
||||
it("should install the PDF tools", function* () {
|
||||
yield Zotero.Fulltext.uninstallPDFTools();
|
||||
assert.isFalse(Zotero.Fulltext.pdfInfoIsRegistered());
|
||||
|
||||
var dataDir = Zotero.DataDirectory.dir;
|
||||
var execFileName = Zotero.Fulltext.pdfInfoFileName;
|
||||
var execPath = OS.Path.join(dataDir, execFileName);
|
||||
var versionFileName = execFileName + '.version';
|
||||
var versionPath = OS.Path.join(dataDir, versionFileName);
|
||||
var scriptExt = Zotero.isWin ? 'vbs' : 'sh';
|
||||
var scriptPath = OS.Path.join(dataDir, 'pdfinfo.' + scriptExt);
|
||||
var scriptContents = yield Zotero.File.getContentsFromURLAsync(
|
||||
'resource://zotero/redirect.' + scriptExt
|
||||
);
|
||||
var cacheExecPath = OS.Path.join(
|
||||
getTestDataDirectory().path, "pdf", pdfToolsVersion, execFileName
|
||||
);
|
||||
|
||||
// Delete existing files
|
||||
try {
|
||||
yield OS.File.remove(execPath);
|
||||
}
|
||||
catch (e) {}
|
||||
try {
|
||||
yield OS.File.remove(versionPath);
|
||||
}
|
||||
catch (e) {}
|
||||
try {
|
||||
yield OS.File.remove(scriptPath);
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
yield Zotero.Fulltext.downloadPDFTool('info', pdfToolsVersion);
|
||||
|
||||
assert.ok(Zotero.Fulltext.pdfInfoIsRegistered());
|
||||
|
||||
assert.equal(
|
||||
(yield Zotero.Utilities.Internal.md5Async(cacheExecPath, false)),
|
||||
(yield Zotero.Utilities.Internal.md5Async(execPath, false))
|
||||
);
|
||||
|
||||
if (!Zotero.isWin) {
|
||||
assert.equal((yield OS.File.stat(execPath)).unixMode, 0o755);
|
||||
}
|
||||
assert.equal(
|
||||
(yield Zotero.File.getContentsAsync(versionPath)),
|
||||
pdfToolsVersion
|
||||
);
|
||||
|
||||
//Temp: disabled on Windows
|
||||
if (!Zotero.isWin) {
|
||||
assert.equal(
|
||||
(yield Zotero.File.getContentsAsync(scriptPath)),
|
||||
scriptContents
|
||||
);
|
||||
assert.equal((yield OS.File.stat(scriptPath)).unixMode, 0o755);
|
||||
}
|
||||
|
||||
yield uninstallPDFTools();
|
||||
assert.isFalse(Zotero.Fulltext.pdfInfoIsRegistered());
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe("#getUnsyncedContent()", function () {
|
||||
before(function* () {
|
||||
yield installPDFTools();
|
||||
})
|
||||
|
||||
after(function* () {
|
||||
yield uninstallPDFTools();
|
||||
})
|
||||
|
||||
it("should get content that hasn't been uploaded", function* () {
|
||||
var toSync = [];
|
||||
var group = yield getGroup();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue