Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit f5f18e9

Browse files
author
Etienne Bonnet
committed
Fixing windows tests
1 parent df9f5cd commit f5f18e9

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

src/test/java/com/silverpeas/openoffice/linux/WhereisStubHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
public class WhereisStubHelper extends WhereisHelper {
3232
@Override
3333
public String whereis() {
34-
return "soffice: /usr/bin/soffice";
34+
return "soffice: /usr/bin/soffice /usr/bin/X11/soffice";
3535
}
3636
}

src/test/java/com/silverpeas/openoffice/windows/MsOfficeFinderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public class MsOfficeFinderTest extends TestCase {
3434

35-
private static final String INSTALLED_OFFICE_PATH = "C:\\PROGRA~2\\MICROS~1\\Office12\\";
35+
private static final String INSTALLED_OFFICE_PATH = "C:\\PROGRA~1\\MICROS~1\\Office12\\";
3636

3737
MsOfficeRegistryHelper helper = new MsOfficeRegistryHelper();
3838

src/test/java/com/silverpeas/openoffice/windows/RegistryHelperTest.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
/**
22
* Copyright (C) 2000 - 2009 Silverpeas
33
*
4-
* This program is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU Affero General Public License as
6-
* published by the Free Software Foundation, either version 3 of the
7-
* License, or (at your option) any later version.
4+
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
5+
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
6+
* version.
87
*
9-
* As a special exception to the terms and conditions of version 3.0 of
10-
* the GPL, you may redistribute this Program in connection with Free/Libre
11-
* Open Source Software ("FLOSS") applications as described in Silverpeas's
12-
* FLOSS exception. You should have received a copy of the text describing
13-
* the FLOSS exception, and it is also available here:
8+
* As a special exception to the terms and conditions of version 3.0 of the GPL, you may redistribute this Program in
9+
* connection with Free/Libre Open Source Software ("FLOSS") applications as described in Silverpeas's FLOSS exception. You
10+
* should have received a copy of the text describing the FLOSS exception, and it is also available here:
1411
* "http://repository.silverpeas.com/legal/licensing"
1512
*
16-
* This program is distributed in the hope that it will be useful,
17-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19-
* GNU Affero General Public License for more details.
13+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
15+
* details.
2016
*
21-
* You should have received a copy of the GNU Affero General Public License
22-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see
18+
* <http://www.gnu.org/licenses/>.
2319
*/
24-
2520
package com.silverpeas.openoffice.windows;
2621

2722
import com.silverpeas.openoffice.util.RegistryKeyReader;
@@ -55,7 +50,7 @@ public void testReadKey() throws Exception {
5550
return;
5651
}
5752
String clockFormat = RegistryKeyReader.readKey(
58-
"\"HKEY_CURRENT_USER\\Software\\Microsoft\\Clock\" /v iFormat");
53+
"\"HKEY_CURRENT_USER\\Control Panel\\International\" /v iTime");
5954
assertNotNull(clockFormat);
6055
assertEquals("1", clockFormat);
6156
}
@@ -83,6 +78,17 @@ public void testFindOpenOffice() throws Exception {
8378
WindowsOpenOfficeFinder helper = new WindowsOpenOfficeFinder();
8479
String openOffice = helper.findOpenOffice();
8580
assertNotNull(openOffice);
81+
if(is64Bits()) {
8682
assertEquals("\"C:\\Program Files (x86)\\OpenOffice.org 3\\program\\soffice.exe\"", openOffice);
83+
}else {
84+
assertEquals("\"C:\\Program Files\\OpenOffice.org 3\\program\\soffice.exe\"", openOffice);
85+
}
86+
}
87+
88+
private boolean is64Bits() {
89+
if (System.getProperty("os.name").contains("Windows")) {
90+
return (System.getenv("ProgramFiles(x86)") != null);
91+
}
92+
return (System.getProperty("os.arch").indexOf("64") != -1);
8793
}
8894
}

0 commit comments

Comments
 (0)